@nsxbet/admin-sdk 0.5.0 → 0.5.1
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/vite/config.d.ts
CHANGED
|
@@ -19,6 +19,14 @@ export interface AdminModuleOptions {
|
|
|
19
19
|
* Additional externals to add to SHARED_EXTERNALS
|
|
20
20
|
*/
|
|
21
21
|
additionalExternals?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Controls when lib mode build config is applied.
|
|
24
|
+
* - "auto" (default): Only apply when ADMIN_MODULE=true env var is set.
|
|
25
|
+
* Use this in Lovable projects so `vite build` produces a normal HTML SPA
|
|
26
|
+
* and `vite build` with ADMIN_MODULE=true produces the module library entry.
|
|
27
|
+
* - "always": Always apply during `vite build`. Used by defineModuleConfig().
|
|
28
|
+
*/
|
|
29
|
+
buildMode?: "auto" | "always";
|
|
22
30
|
}
|
|
23
31
|
export interface ModuleConfigOptions extends AdminModuleOptions {
|
|
24
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/vite/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,iFAMnB,CAAC;AAEX,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/vite/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,iFAMnB,CAAC;AAEX,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAE/B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IAEH,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAEhB;;OAEG;IAEH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,MAAM,EAAE,CA8CtE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,GAAG,CAiBpE"}
|
package/dist/vite/config.js
CHANGED
|
@@ -43,12 +43,17 @@ export const SHARED_EXTERNALS = [
|
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
45
|
export function adminModule(options = {}) {
|
|
46
|
-
const { entry = "./src/spa.tsx", outDir = "dist", additionalExternals = [], } = options;
|
|
46
|
+
const { entry = "./src/spa.tsx", outDir = "dist", additionalExternals = [], buildMode = "auto", } = options;
|
|
47
47
|
const externals = [...SHARED_EXTERNALS, ...additionalExternals];
|
|
48
|
+
function isModuleBuild() {
|
|
49
|
+
if (buildMode === "always")
|
|
50
|
+
return true;
|
|
51
|
+
return process.env.ADMIN_MODULE === "true";
|
|
52
|
+
}
|
|
48
53
|
const buildConfigPlugin = {
|
|
49
54
|
name: "admin-module-build-config",
|
|
50
55
|
config(_config, { command }) {
|
|
51
|
-
if (command !== "build")
|
|
56
|
+
if (command !== "build" || !isModuleBuild())
|
|
52
57
|
return;
|
|
53
58
|
return {
|
|
54
59
|
build: {
|
|
@@ -113,7 +118,7 @@ export function adminModule(options = {}) {
|
|
|
113
118
|
export function defineModuleConfig(options) {
|
|
114
119
|
const { port = 8080, plugins = [], overrides = {} } = options;
|
|
115
120
|
return {
|
|
116
|
-
plugins: [...adminModule(options), ...plugins],
|
|
121
|
+
plugins: [...adminModule({ ...options, buildMode: "always" }), ...plugins],
|
|
117
122
|
define: {
|
|
118
123
|
"process.env": {},
|
|
119
124
|
"process.env.NODE_ENV": JSON.stringify("production"),
|