@ubean/build 0.1.5 → 0.1.6
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/index.d.ts +4 -0
- package/dist/index.js +17 -8
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ declare function createLocalesVirtualModule(_locales: ScannedLocale[], defaultLo
|
|
|
49
49
|
*
|
|
50
50
|
* Registration happens at module load time (when ubeanUiPlugin() etc. are
|
|
51
51
|
* called by the module system, before ubeanVuePlugin reads the registry).
|
|
52
|
+
*
|
|
53
|
+
* Uses globalThis for storage to ensure state is shared across multiple
|
|
54
|
+
* copies of @ubean/build that may exist due to package manager duplication
|
|
55
|
+
* (e.g. pnpm creating separate instances for different version ranges).
|
|
52
56
|
*/
|
|
53
57
|
/**
|
|
54
58
|
* Generic component resolver type compatible with unplugin-vue-components.
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { a as createRoutingVirtualModule, c as VirtualModuleRegistry, d as resetVirtualRegistry, f as useVirtualRegistry, i as createPagesVirtualModule, l as defineVirtualModule, n as createLocalesVirtualModule, o as stripMacros, r as createMetaVirtualModule, s as transformMacros, t as createAppVirtualModule, u as defineVirtualModulePrefix } from "./virtual-modules-DXIaZdQI.js";
|
|
2
2
|
//#region src/registry.ts
|
|
3
|
-
const
|
|
4
|
-
|
|
3
|
+
const REGISTRY_KEY = "__ubean_module_registry__";
|
|
4
|
+
function getRegistry() {
|
|
5
|
+
const g = globalThis;
|
|
6
|
+
if (!g[REGISTRY_KEY]) g[REGISTRY_KEY] = {
|
|
7
|
+
componentResolvers: [],
|
|
8
|
+
cssImports: []
|
|
9
|
+
};
|
|
10
|
+
return g[REGISTRY_KEY];
|
|
11
|
+
}
|
|
5
12
|
/**
|
|
6
13
|
* Register a component resolver (e.g. `UiResolver()` from `@soybeanjs/ui/resolver`).
|
|
7
14
|
* The resolver will be merged into `unplugin-vue-components`'s `resolvers` array.
|
|
8
15
|
*/
|
|
9
16
|
function registerComponentResolver(resolver) {
|
|
10
|
-
componentResolvers.push(resolver);
|
|
17
|
+
getRegistry().componentResolvers.push(resolver);
|
|
11
18
|
}
|
|
12
19
|
/**
|
|
13
20
|
* Get all registered component resolvers.
|
|
14
21
|
* Called by `ubeanVuePlugin` when constructing the `Components()` plugin.
|
|
15
22
|
*/
|
|
16
23
|
function getComponentResolvers() {
|
|
17
|
-
return [...componentResolvers];
|
|
24
|
+
return [...getRegistry().componentResolvers];
|
|
18
25
|
}
|
|
19
26
|
/**
|
|
20
27
|
* Register a CSS import path to be injected into the client entry.
|
|
@@ -22,22 +29,24 @@ function getComponentResolvers() {
|
|
|
22
29
|
* entry module prepend `import '@soybeanjs/ui/styles.css'`.
|
|
23
30
|
*/
|
|
24
31
|
function registerCssImport(cssPath) {
|
|
25
|
-
|
|
32
|
+
const reg = getRegistry();
|
|
33
|
+
if (!reg.cssImports.includes(cssPath)) reg.cssImports.push(cssPath);
|
|
26
34
|
}
|
|
27
35
|
/**
|
|
28
36
|
* Get all registered CSS import paths.
|
|
29
37
|
* Called by `createClientEntryVirtualModule` to prepend CSS imports.
|
|
30
38
|
*/
|
|
31
39
|
function getCssImports() {
|
|
32
|
-
return [...cssImports];
|
|
40
|
+
return [...getRegistry().cssImports];
|
|
33
41
|
}
|
|
34
42
|
/**
|
|
35
43
|
* Reset the registry (for testing).
|
|
36
44
|
* @internal
|
|
37
45
|
*/
|
|
38
46
|
function resetModuleRegistry() {
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
const reg = getRegistry();
|
|
48
|
+
reg.componentResolvers.length = 0;
|
|
49
|
+
reg.cssImports.length = 0;
|
|
41
50
|
}
|
|
42
51
|
//#endregion
|
|
43
52
|
export { VirtualModuleRegistry, createAppVirtualModule, createLocalesVirtualModule, createMetaVirtualModule, createPagesVirtualModule, createRoutingVirtualModule, defineVirtualModule, defineVirtualModulePrefix, getComponentResolvers, getCssImports, registerComponentResolver, registerCssImport, resetModuleRegistry, resetVirtualRegistry, stripMacros, transformMacros, useVirtualRegistry };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/build",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Core Vite plugin (framework-agnostic) for ubean (ubeanPlugin, virtual modules: routes/pages/meta/app-config/locales, macros)",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -28,14 +28,14 @@
|
|
|
28
28
|
"consola": "^3.4.2",
|
|
29
29
|
"oxc-transform": "^0.141.0",
|
|
30
30
|
"pathe": "^2.0.3",
|
|
31
|
-
"@ubean/config": "0.1.
|
|
32
|
-
"@ubean/islands": "0.1.
|
|
33
|
-
"@ubean/
|
|
34
|
-
"@ubean/
|
|
35
|
-
"@ubean/
|
|
36
|
-
"@ubean/
|
|
37
|
-
"@ubean/
|
|
38
|
-
"@ubean/
|
|
31
|
+
"@ubean/config": "0.1.6",
|
|
32
|
+
"@ubean/islands": "0.1.6",
|
|
33
|
+
"@ubean/modules": "0.1.6",
|
|
34
|
+
"@ubean/preset": "0.1.6",
|
|
35
|
+
"@ubean/ssr": "0.1.6",
|
|
36
|
+
"@ubean/routing": "0.1.6",
|
|
37
|
+
"@ubean/vite": "0.1.6",
|
|
38
|
+
"@ubean/utils": "0.1.6"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^26.1.1",
|