@creopse/bridge 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/dist/react-DqofO0Uc.js +118 -0
- package/dist/vite/index.js +3 -4
- package/dist/vite/react.js +9 -95
- package/dist/vite/vue.d.ts +37 -3
- package/dist/vite/vue.js +75 -37
- package/package.json +1 -1
- package/dist/helper-DBW7QA4d.js +0 -26
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import h from "@vitejs/plugin-basic-ssl";
|
|
2
|
+
import { parse as A, stringify as y } from "comment-json";
|
|
3
|
+
import c from "path";
|
|
4
|
+
import w from "rollup-plugin-copy";
|
|
5
|
+
import S from "vite-plugin-auto-import-lite";
|
|
6
|
+
import _ from "vite-plugin-json5";
|
|
7
|
+
import E from "vite-plugin-top-level-await";
|
|
8
|
+
import { DASHBOARD_MODULE_NAME as I, SETTINGS_MODULE_NAME as D, sanitizeId as b } from "@creopse/utils/helpers";
|
|
9
|
+
import g from "fs";
|
|
10
|
+
function j(e = "./manifest.jsonc") {
|
|
11
|
+
const d = process.cwd(), l = c.resolve(d, e), n = {};
|
|
12
|
+
let m = "creopse-plugin", r = "remoteEntry.js", t;
|
|
13
|
+
try {
|
|
14
|
+
if (g.existsSync(l)) {
|
|
15
|
+
const f = g.readFileSync(l, "utf-8");
|
|
16
|
+
if (t = A(f || "{}"), Array.isArray(t.pages))
|
|
17
|
+
for (const a of t.pages)
|
|
18
|
+
a.name && a.module && (n[`./${a.name}`] = a.module);
|
|
19
|
+
const o = t.dashboard;
|
|
20
|
+
o?.module && (n[`./${I}`] = o.module);
|
|
21
|
+
const i = t.settings;
|
|
22
|
+
i?.module && (n[`./${D}`] = i.module), m = b(String(t.id)) || m, r = t.entry || r;
|
|
23
|
+
}
|
|
24
|
+
} catch (f) {
|
|
25
|
+
console.error(`[Creopse] Failed to parse manifest at ${l}:`, f);
|
|
26
|
+
}
|
|
27
|
+
return { pluginId: m, pluginEntry: r, exposes: n, manifest: t };
|
|
28
|
+
}
|
|
29
|
+
function T(e = {}) {
|
|
30
|
+
const {
|
|
31
|
+
srcDir: d = "./src",
|
|
32
|
+
outDir: l = "frontend",
|
|
33
|
+
hooksDirs: n = ["src/hooks"],
|
|
34
|
+
eslintAutoImport: m = !1
|
|
35
|
+
} = e, r = process.cwd(), t = process.env.APP_IS_PREVIEW === "true", f = typeof e.manifest == "object" ? e.manifest : j(e.manifest || "./manifest.jsonc"), { manifest: o } = f, i = o?.development, a = !!i?.ssl, v = {
|
|
36
|
+
name: "creopse-react-plugin",
|
|
37
|
+
config(s) {
|
|
38
|
+
const p = s.root || r, u = c.resolve(p, l), P = typeof e.manifest == "string" ? e.manifest : "./manifest.jsonc";
|
|
39
|
+
return {
|
|
40
|
+
envPrefix: "APP_",
|
|
41
|
+
resolve: {
|
|
42
|
+
alias: [{ find: "@", replacement: c.resolve(p, d) }],
|
|
43
|
+
dedupe: ["react", "react-dom", "zustand"]
|
|
44
|
+
},
|
|
45
|
+
build: {
|
|
46
|
+
target: "esnext",
|
|
47
|
+
outDir: u,
|
|
48
|
+
assetsInlineLimit: 1 / 0,
|
|
49
|
+
cssCodeSplit: !1,
|
|
50
|
+
rollupOptions: {
|
|
51
|
+
plugins: [
|
|
52
|
+
w({
|
|
53
|
+
targets: [
|
|
54
|
+
{
|
|
55
|
+
src: c.resolve(r, P),
|
|
56
|
+
dest: u,
|
|
57
|
+
transform() {
|
|
58
|
+
return o?.mode && (o.mode = t ? "development" : "production"), y(o, null, 2).replace(
|
|
59
|
+
/(,)\s*\n/g,
|
|
60
|
+
`,
|
|
61
|
+
|
|
62
|
+
`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
hook: "writeBundle"
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
preview: {
|
|
73
|
+
port: i?.previewPort || 2160,
|
|
74
|
+
strictPort: !0,
|
|
75
|
+
cors: !0,
|
|
76
|
+
headers: { "Access-Control-Allow-Origin": "*" }
|
|
77
|
+
},
|
|
78
|
+
server: {
|
|
79
|
+
port: i?.serverPort || 2161,
|
|
80
|
+
cors: !0,
|
|
81
|
+
headers: { "Access-Control-Allow-Origin": "*" }
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
configureServer(s) {
|
|
86
|
+
const p = typeof e.manifest == "string" ? c.resolve(r, e.manifest) : c.resolve(r, "./manifest.jsonc");
|
|
87
|
+
s.watcher.add(p), s.watcher.on("change", (u) => {
|
|
88
|
+
u === p && (console.info(`
|
|
89
|
+
[Creopse] Manifest changed, restarting server...`), s.restart());
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
return [
|
|
94
|
+
_(),
|
|
95
|
+
E({
|
|
96
|
+
promiseExportName: "__tla",
|
|
97
|
+
promiseImportName: (s) => `__tla_${s}`
|
|
98
|
+
}),
|
|
99
|
+
S({
|
|
100
|
+
dirs: n,
|
|
101
|
+
imports: ["react"],
|
|
102
|
+
vueTemplate: !1,
|
|
103
|
+
...m ? {
|
|
104
|
+
eslintrc: {
|
|
105
|
+
enabled: !0,
|
|
106
|
+
filepath: "./.eslintrc-auto-import.json",
|
|
107
|
+
globalsPropValue: !0
|
|
108
|
+
}
|
|
109
|
+
} : {}
|
|
110
|
+
}),
|
|
111
|
+
...a ? [h()] : [],
|
|
112
|
+
v
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
T as C,
|
|
117
|
+
j as l
|
|
118
|
+
};
|
package/dist/vite/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CreopseVuePlugin as r } from "./vue.js";
|
|
2
|
-
import {
|
|
3
|
-
import { l as a } from "../helper-DBW7QA4d.js";
|
|
2
|
+
import { C as a, l as p } from "../react-DqofO0Uc.js";
|
|
4
3
|
export {
|
|
5
|
-
|
|
4
|
+
a as CreopseReactPlugin,
|
|
6
5
|
r as CreopseVuePlugin,
|
|
7
|
-
|
|
6
|
+
p as loadCreopseManifest
|
|
8
7
|
};
|
package/dist/vite/react.js
CHANGED
|
@@ -1,97 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
function k(e = {}) {
|
|
10
|
-
const {
|
|
11
|
-
srcDir: c = "./src",
|
|
12
|
-
outDir: l = "frontend",
|
|
13
|
-
hooksDirs: m = ["src/hooks"],
|
|
14
|
-
eslintAutoImport: f = !1
|
|
15
|
-
} = e, s = process.cwd(), p = process.env.APP_IS_PREVIEW === "true", u = typeof e.manifest == "object" ? e.manifest : b(e.manifest || "./manifest.jsonc"), { manifest: n } = u, a = n?.development, d = !!a?.ssl, g = {
|
|
16
|
-
name: "creopse-react-plugin",
|
|
17
|
-
config(t) {
|
|
18
|
-
const r = t.root || s, i = o.resolve(r, l), v = typeof e.manifest == "string" ? e.manifest : "./manifest.jsonc";
|
|
19
|
-
return {
|
|
20
|
-
envPrefix: "APP_",
|
|
21
|
-
resolve: {
|
|
22
|
-
alias: [{ find: "@", replacement: o.resolve(r, c) }],
|
|
23
|
-
dedupe: ["react", "react-dom", "zustand"]
|
|
24
|
-
},
|
|
25
|
-
build: {
|
|
26
|
-
target: "esnext",
|
|
27
|
-
outDir: i,
|
|
28
|
-
assetsInlineLimit: 1 / 0,
|
|
29
|
-
cssCodeSplit: !1,
|
|
30
|
-
rollupOptions: {
|
|
31
|
-
plugins: [
|
|
32
|
-
w({
|
|
33
|
-
targets: [
|
|
34
|
-
{
|
|
35
|
-
src: o.resolve(s, v),
|
|
36
|
-
dest: i,
|
|
37
|
-
transform() {
|
|
38
|
-
return n?.mode && (n.mode = p ? "development" : "production"), h(n, null, 2).replace(
|
|
39
|
-
/(,)\s*\n/g,
|
|
40
|
-
`,
|
|
41
|
-
|
|
42
|
-
`
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
hook: "writeBundle"
|
|
48
|
-
})
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
preview: {
|
|
53
|
-
port: a?.previewPort || 2160,
|
|
54
|
-
strictPort: !0,
|
|
55
|
-
cors: !0,
|
|
56
|
-
headers: { "Access-Control-Allow-Origin": "*" }
|
|
57
|
-
},
|
|
58
|
-
server: {
|
|
59
|
-
port: a?.serverPort || 2161,
|
|
60
|
-
cors: !0,
|
|
61
|
-
headers: { "Access-Control-Allow-Origin": "*" }
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
},
|
|
65
|
-
configureServer(t) {
|
|
66
|
-
const r = typeof e.manifest == "string" ? o.resolve(s, e.manifest) : o.resolve(s, "./manifest.jsonc");
|
|
67
|
-
t.watcher.add(r), t.watcher.on("change", (i) => {
|
|
68
|
-
i === r && (console.info(`
|
|
69
|
-
[Creopse] Manifest changed, restarting server...`), t.restart());
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
return [
|
|
74
|
-
_(),
|
|
75
|
-
I({
|
|
76
|
-
promiseExportName: "__tla",
|
|
77
|
-
promiseImportName: (t) => `__tla_${t}`
|
|
78
|
-
}),
|
|
79
|
-
A({
|
|
80
|
-
dirs: m,
|
|
81
|
-
imports: ["react"],
|
|
82
|
-
vueTemplate: !1,
|
|
83
|
-
...f ? {
|
|
84
|
-
eslintrc: {
|
|
85
|
-
enabled: !0,
|
|
86
|
-
filepath: "./.eslintrc-auto-import.json",
|
|
87
|
-
globalsPropValue: !0
|
|
88
|
-
}
|
|
89
|
-
} : {}
|
|
90
|
-
}),
|
|
91
|
-
...d ? [P()] : [],
|
|
92
|
-
g
|
|
93
|
-
];
|
|
94
|
-
}
|
|
1
|
+
import "@vitejs/plugin-basic-ssl";
|
|
2
|
+
import "comment-json";
|
|
3
|
+
import "path";
|
|
4
|
+
import "rollup-plugin-copy";
|
|
5
|
+
import "vite-plugin-auto-import-lite";
|
|
6
|
+
import "vite-plugin-json5";
|
|
7
|
+
import "vite-plugin-top-level-await";
|
|
8
|
+
import { C } from "../react-DqofO0Uc.js";
|
|
95
9
|
export {
|
|
96
|
-
|
|
10
|
+
C as CreopseReactPlugin
|
|
97
11
|
};
|
package/dist/vite/vue.d.ts
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
import { PluginOption } from 'vite';
|
|
2
|
-
|
|
2
|
+
export interface CreopseVuePluginOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Path to the manifest.jsonc file, relative to the project root.
|
|
5
|
+
* @default './manifest.jsonc'
|
|
6
|
+
*/
|
|
7
|
+
manifestPath?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Source directory, relative to the project root.
|
|
10
|
+
* @default './src'
|
|
11
|
+
*/
|
|
12
|
+
srcDir?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Output directory for the build.
|
|
15
|
+
* @default 'frontend'
|
|
16
|
+
*/
|
|
17
|
+
outDir?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Path to the i18n locales directory, relative to the project root.
|
|
20
|
+
* @default './src/i18n/locales'
|
|
21
|
+
*/
|
|
22
|
+
i18nLocalesPath?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Directories to scan for auto-imports, relative to the project root.
|
|
25
|
+
* @default ['src/composables']
|
|
26
|
+
*/
|
|
27
|
+
composablesDirs?: string[];
|
|
28
|
+
/**
|
|
29
|
+
* Shared modules for Module Federation.
|
|
30
|
+
* The 'vue' and 'pinia' modules are always included.
|
|
31
|
+
* @default []
|
|
32
|
+
*/
|
|
33
|
+
shared?: string[];
|
|
34
|
+
}
|
|
3
35
|
/**
|
|
4
|
-
* Vite plugin for Creopse Vue
|
|
5
|
-
*
|
|
36
|
+
* Vite plugin for Creopse Vue applications.
|
|
37
|
+
* Handles manifest parsing, Module Federation, and automatic environment configuration.
|
|
38
|
+
* * @param options - Configuration options for the plugin
|
|
39
|
+
* @returns A flat array of Vite plugins
|
|
6
40
|
*/
|
|
7
41
|
export declare function CreopseVuePlugin(options?: CreopseVuePluginOptions): PluginOption[];
|
package/dist/vite/vue.js
CHANGED
|
@@ -1,89 +1,127 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { DASHBOARD_MODULE_NAME as S, SETTINGS_MODULE_NAME as C, sanitizeId as D } from "@creopse/utils/helpers";
|
|
2
|
+
import I from "@originjs/vite-plugin-federation";
|
|
3
|
+
import b from "@vitejs/plugin-basic-ssl";
|
|
4
|
+
import { parse as L, stringify as M } from "comment-json";
|
|
5
|
+
import g from "fs";
|
|
6
|
+
import f from "path";
|
|
7
|
+
import O from "rollup-plugin-copy";
|
|
8
|
+
import x from "vite-plugin-auto-import-lite";
|
|
9
|
+
import V from "vite-plugin-json5";
|
|
10
|
+
import N from "vite-plugin-top-level-await";
|
|
11
|
+
function H(v = {}) {
|
|
10
12
|
const {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
manifestPath: P = "./manifest.jsonc",
|
|
14
|
+
srcDir: h = "./src",
|
|
15
|
+
outDir: A = "frontend",
|
|
16
|
+
i18nLocalesPath: $,
|
|
17
|
+
composablesDirs: w = ["src/composables"],
|
|
18
|
+
shared: _ = []
|
|
19
|
+
} = v, d = process.cwd(), t = f.resolve(d, P), y = process.env.APP_IS_PREVIEW === "true";
|
|
20
|
+
let e;
|
|
21
|
+
const n = {};
|
|
22
|
+
let l = "creopse-plugin", p = "remoteEntry.js", c = 2160, m = 2161, u = !1;
|
|
23
|
+
try {
|
|
24
|
+
if (g.existsSync(t)) {
|
|
25
|
+
const r = g.readFileSync(t, "utf-8");
|
|
26
|
+
if (e = L(r || "{}"), e.pages && Array.isArray(e.pages))
|
|
27
|
+
for (const a of e.pages)
|
|
28
|
+
n[`./${a.name}`] = a.module;
|
|
29
|
+
const o = e.dashboard;
|
|
30
|
+
o?.module && (n[`./${S}`] = o.module);
|
|
31
|
+
const s = e.settings;
|
|
32
|
+
s?.module && (n[`./${C}`] = s.module);
|
|
33
|
+
const i = e.development;
|
|
34
|
+
l = D(String(e.id)) || l, p = e.entry || p, c = i?.previewPort || c, m = i?.serverPort || m, u = i?.ssl || u;
|
|
35
|
+
} else
|
|
36
|
+
console.warn(
|
|
37
|
+
`[CreopseVuePlugin] Warning: Manifest not found at ${t}`
|
|
38
|
+
);
|
|
39
|
+
} catch (r) {
|
|
40
|
+
console.error(
|
|
41
|
+
"[CreopseVuePlugin] Fatal error while parsing manifest:",
|
|
42
|
+
r
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
const E = {
|
|
15
46
|
name: "creopse-vue-plugin",
|
|
16
47
|
config(r) {
|
|
17
|
-
const
|
|
48
|
+
const o = r.root || d, s = f.resolve(o, A);
|
|
18
49
|
return {
|
|
19
50
|
envPrefix: "APP_",
|
|
20
51
|
resolve: {
|
|
21
|
-
alias: [{ find: "@", replacement:
|
|
52
|
+
alias: [{ find: "@", replacement: f.resolve(o, h) }],
|
|
22
53
|
dedupe: ["vue"]
|
|
23
54
|
},
|
|
24
55
|
build: {
|
|
25
56
|
target: "esnext",
|
|
26
|
-
outDir:
|
|
57
|
+
outDir: s,
|
|
27
58
|
assetsInlineLimit: 1 / 0,
|
|
28
59
|
cssCodeSplit: !1,
|
|
29
60
|
rollupOptions: {
|
|
30
61
|
plugins: [
|
|
31
|
-
|
|
62
|
+
O({
|
|
32
63
|
targets: [
|
|
33
64
|
{
|
|
34
|
-
src:
|
|
35
|
-
dest:
|
|
65
|
+
src: t,
|
|
66
|
+
dest: s,
|
|
36
67
|
transform() {
|
|
37
|
-
return
|
|
38
|
-
/(,)\s*\n/g,
|
|
39
|
-
`,
|
|
68
|
+
return e?.mode && (e.mode = y ? "development" : "production"), ((a) => a.replace(/(,)\s*\n/g, `,
|
|
40
69
|
|
|
41
|
-
`
|
|
70
|
+
`))(
|
|
71
|
+
M(e, null, 2)
|
|
42
72
|
);
|
|
43
73
|
}
|
|
44
74
|
}
|
|
45
75
|
],
|
|
46
|
-
hook: "writeBundle"
|
|
76
|
+
hook: "writeBundle",
|
|
77
|
+
flatten: !0
|
|
47
78
|
})
|
|
48
79
|
]
|
|
49
80
|
}
|
|
50
81
|
},
|
|
51
82
|
preview: {
|
|
52
|
-
port:
|
|
83
|
+
port: c,
|
|
53
84
|
strictPort: !0,
|
|
54
85
|
cors: !0,
|
|
55
86
|
headers: { "Access-Control-Allow-Origin": "*" }
|
|
56
87
|
},
|
|
57
88
|
server: {
|
|
58
|
-
port:
|
|
89
|
+
port: m,
|
|
59
90
|
cors: !0,
|
|
60
91
|
headers: { "Access-Control-Allow-Origin": "*" }
|
|
61
92
|
}
|
|
62
93
|
};
|
|
63
94
|
},
|
|
64
95
|
configureServer(r) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
[
|
|
96
|
+
r.watcher.add(t), r.watcher.on("change", (o) => {
|
|
97
|
+
o === t && (console.info(
|
|
98
|
+
`
|
|
99
|
+
[CreopseVuePlugin] Manifest changed, restarting Vite...`
|
|
100
|
+
), r.restart());
|
|
69
101
|
});
|
|
70
102
|
}
|
|
71
103
|
};
|
|
72
104
|
return [
|
|
73
|
-
|
|
74
|
-
|
|
105
|
+
V(),
|
|
106
|
+
I({
|
|
107
|
+
name: l,
|
|
108
|
+
filename: p,
|
|
109
|
+
exposes: n,
|
|
110
|
+
shared: ["vue", "pinia", ..._]
|
|
111
|
+
}),
|
|
112
|
+
N({
|
|
75
113
|
promiseExportName: "__tla",
|
|
76
114
|
promiseImportName: (r) => `__tla_${r}`
|
|
77
115
|
}),
|
|
78
|
-
|
|
79
|
-
dirs:
|
|
116
|
+
x({
|
|
117
|
+
dirs: w,
|
|
80
118
|
imports: ["vue", "pinia"],
|
|
81
119
|
vueTemplate: !0
|
|
82
120
|
}),
|
|
83
|
-
...u ? [
|
|
84
|
-
|
|
121
|
+
...u ? [b()] : [],
|
|
122
|
+
E
|
|
85
123
|
];
|
|
86
124
|
}
|
|
87
125
|
export {
|
|
88
|
-
|
|
126
|
+
H as CreopseVuePlugin
|
|
89
127
|
};
|
package/package.json
CHANGED
package/dist/helper-DBW7QA4d.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { DASHBOARD_MODULE_NAME as c, SETTINGS_MODULE_NAME as d, sanitizeId as u } from "@creopse/utils/helpers";
|
|
2
|
-
import { parse as g } from "comment-json";
|
|
3
|
-
import m from "fs";
|
|
4
|
-
import y from "path";
|
|
5
|
-
function h(f = "./manifest.jsonc") {
|
|
6
|
-
const p = process.cwd(), t = y.resolve(p, f), o = {};
|
|
7
|
-
let s = "creopse-plugin", n = "remoteEntry.js", e;
|
|
8
|
-
try {
|
|
9
|
-
if (m.existsSync(t)) {
|
|
10
|
-
const i = m.readFileSync(t, "utf-8");
|
|
11
|
-
if (e = g(i || "{}"), Array.isArray(e.pages))
|
|
12
|
-
for (const r of e.pages)
|
|
13
|
-
r.name && r.module && (o[`./${r.name}`] = r.module);
|
|
14
|
-
const a = e.dashboard;
|
|
15
|
-
a?.module && (o[`./${c}`] = a.module);
|
|
16
|
-
const l = e.settings;
|
|
17
|
-
l?.module && (o[`./${d}`] = l.module), s = u(String(e.id)) || s, n = e.entry || n;
|
|
18
|
-
}
|
|
19
|
-
} catch (i) {
|
|
20
|
-
console.error(`[Creopse] Failed to parse manifest at ${t}:`, i);
|
|
21
|
-
}
|
|
22
|
-
return { pluginId: s, pluginEntry: n, exposes: o, manifest: e };
|
|
23
|
-
}
|
|
24
|
-
export {
|
|
25
|
-
h as l
|
|
26
|
-
};
|