@withl5e/l5e 0.3.3-alpha.0 → 0.3.3-alpha.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/global-style-DFvaBcuR.js +27 -0
- package/dist/global-style-DFvaBcuR.js.map +1 -0
- package/dist/server.js +294 -280
- package/dist/server.js.map +1 -1
- package/dist/vite-plugin.js +124 -119
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +1 -1
- package/src/core/global-style.ts +35 -0
- package/src/core/server.ts +22 -9
- package/src/core/vite-plugin.ts +13 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { existsSync as c } from "node:fs";
|
|
2
|
+
import { join as i } from "node:path";
|
|
3
|
+
const a = "/src/global.css", s = "src/global.css";
|
|
4
|
+
function f(n) {
|
|
5
|
+
const t = i(n, s);
|
|
6
|
+
return c(t) ? t : null;
|
|
7
|
+
}
|
|
8
|
+
function r(n, t) {
|
|
9
|
+
const l = t.replace(/^\/+/, "");
|
|
10
|
+
return `${n.endsWith("/") ? n : `${n}/`}${l}`;
|
|
11
|
+
}
|
|
12
|
+
function m({
|
|
13
|
+
root: n,
|
|
14
|
+
manifest: t,
|
|
15
|
+
isProduction: l,
|
|
16
|
+
base: o
|
|
17
|
+
}) {
|
|
18
|
+
if (!l)
|
|
19
|
+
return f(n) ? r(o, a) : null;
|
|
20
|
+
const e = t?.[s]?.file;
|
|
21
|
+
return typeof e == "string" ? r(o, e) : null;
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
f,
|
|
25
|
+
m as r
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=global-style-DFvaBcuR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"global-style-DFvaBcuR.js","sources":["../src/core/global-style.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\n\nexport const GLOBAL_STYLE_SOURCE = '/src/global.css';\nexport const GLOBAL_STYLE_MANIFEST_KEY = 'src/global.css';\n\nexport function findGlobalStyleInput(root: string): string | null {\n const absolutePath = join(root, GLOBAL_STYLE_MANIFEST_KEY);\n return existsSync(absolutePath) ? absolutePath : null;\n}\n\nexport function withAssetBase(base: string, assetPath: string): string {\n const cleanPath = assetPath.replace(/^\\/+/, '');\n const normalizedBase = base.endsWith('/') ? base : `${base}/`;\n return `${normalizedBase}${cleanPath}`;\n}\n\nexport function resolveGlobalStyleHref({\n root,\n manifest,\n isProduction,\n base,\n}: {\n root: string;\n manifest?: Record<string, any>;\n isProduction: boolean;\n base: string;\n}): string | null {\n if (!isProduction) {\n return findGlobalStyleInput(root) ? withAssetBase(base, GLOBAL_STYLE_SOURCE) : null;\n }\n\n const file = manifest?.[GLOBAL_STYLE_MANIFEST_KEY]?.file;\n return typeof file === 'string' ? withAssetBase(base, file) : null;\n}\n"],"names":["GLOBAL_STYLE_SOURCE","GLOBAL_STYLE_MANIFEST_KEY","findGlobalStyleInput","root","absolutePath","join","existsSync","withAssetBase","base","assetPath","cleanPath","resolveGlobalStyleHref","manifest","isProduction","file"],"mappings":";;AAGO,MAAMA,IAAsB,mBACtBC,IAA4B;AAElC,SAASC,EAAqBC,GAA6B;AAChE,QAAMC,IAAeC,EAAKF,GAAMF,CAAyB;AACzD,SAAOK,EAAWF,CAAY,IAAIA,IAAe;AACnD;AAEO,SAASG,EAAcC,GAAcC,GAA2B;AACrE,QAAMC,IAAYD,EAAU,QAAQ,QAAQ,EAAE;AAE9C,SAAO,GADgBD,EAAK,SAAS,GAAG,IAAIA,IAAO,GAAGA,CAAI,GAClC,GAAGE,CAAS;AACtC;AAEO,SAASC,EAAuB;AAAA,EACrC,MAAAR;AAAA,EACA,UAAAS;AAAA,EACA,cAAAC;AAAA,EACA,MAAAL;AACF,GAKkB;AAChB,MAAI,CAACK;AACH,WAAOX,EAAqBC,CAAI,IAAII,EAAcC,GAAMR,CAAmB,IAAI;AAGjF,QAAMc,IAAOF,IAAWX,CAAyB,GAAG;AACpD,SAAO,OAAOa,KAAS,WAAWP,EAAcC,GAAMM,CAAI,IAAI;AAChE;"}
|