@origen-ui/admin-cli 1.0.3 → 1.1.0
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/package.json +3 -3
- package/templates/current/clean/CHANGELOG.md +34 -0
- package/templates/current/clean/component-catalog.json +9 -9
- package/templates/current/clean/package.json +41 -41
- package/templates/current/clean/scaffold.lock.json +2 -2
- package/templates/current/clean/scripts/vite-build-policy.spec.ts +71 -0
- package/templates/current/clean/src/App.vue +10 -3
- package/templates/current/clean/src/api/client.ts +90 -10
- package/templates/current/clean/src/api/generated/data-contracts.ts +3 -3
- package/templates/current/clean/src/api/generated/http-client.ts +1 -1
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +1 -1
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +1 -1
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +1 -1
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +2 -3
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +3 -5
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +2 -3
- package/templates/current/clean/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +2 -3
- package/templates/current/clean/src/api/generated//350/256/244/350/257/201.ts +1 -1
- package/templates/current/clean/src/app/adminLocale.ts +90 -0
- package/templates/current/clean/src/app/createAdminUi.spec.ts +65 -9
- package/templates/current/clean/src/app/createAdminUi.ts +14 -29
- package/templates/current/clean/src/app/embedded-token.spec.ts +40 -0
- package/templates/current/clean/src/app/embedded.spec.ts +135 -0
- package/templates/current/clean/src/app/embedded.ts +255 -0
- package/templates/current/clean/src/app/localeFormat.ts +52 -0
- package/templates/current/clean/src/app/menu.spec.ts +26 -0
- package/templates/current/clean/src/app/menu.ts +4 -0
- package/templates/current/clean/src/app/menuTypes.ts +1 -0
- package/templates/current/clean/src/app/origenUiLocale.spec.ts +6 -5
- package/templates/current/clean/src/app/origenUiLocale.ts +3 -58
- package/templates/current/clean/src/app/permission.spec.ts +26 -0
- package/templates/current/clean/src/app/runtimeConfig.ts +8 -7
- package/templates/current/clean/src/env.d.ts +18 -0
- package/templates/current/clean/src/features/appearance/components/ThemePanel.vue +21 -17
- package/templates/current/clean/src/features/appearance/store/theme.ts +2 -1
- package/templates/current/clean/src/features/auth/pages/Login.vue +15 -11
- package/templates/current/clean/src/features/auth/store/auth.ts +13 -3
- package/templates/current/clean/src/features/security/components/DevtoolsProtectionOverlay.vue +5 -2
- package/templates/current/clean/src/features/security/devtoolsProtection.spec.ts +7 -10
- package/templates/current/clean/src/features/security/devtoolsProtection.ts +2 -1
- package/templates/current/clean/src/features/system/access/api/admin-repository.spec.ts +14 -0
- package/templates/current/clean/src/features/system/access/api/admin-repository.ts +38 -15
- package/templates/current/clean/src/features/system/access/api/rbac.ts +37 -27
- package/templates/current/clean/src/features/workspace/pages/Empty.vue +4 -1
- package/templates/current/clean/src/features/workspace/pages/Profile.vue +13 -11
- package/templates/current/clean/src/layouts/AdminLayout.vue +3 -1
- package/templates/current/clean/src/layouts/TopBar.vue +26 -8
- package/templates/current/clean/src/locales/en-US.json +490 -0
- package/templates/current/clean/src/locales/en-US.runtime.ts +20 -0
- package/templates/current/clean/src/locales/index.ts +129 -45
- package/templates/current/clean/src/locales/messages-types.ts +62 -0
- package/templates/current/clean/src/locales/messages.spec.ts +113 -6
- package/templates/current/clean/src/locales/vue-i18n.d.ts +5 -0
- package/templates/current/clean/src/locales/zh-CN.json +490 -0
- package/templates/current/clean/src/locales/zh-CN.runtime.ts +20 -0
- package/templates/current/clean/src/locales/zh-TW.json +490 -0
- package/templates/current/clean/src/locales/zh-TW.runtime.ts +20 -0
- package/templates/current/clean/src/router/bootstrap.ts +22 -7
- package/templates/current/clean/src/router/dynamicRoutes.ts +5 -1
- package/templates/current/clean/src/router/queryEncryption.spec.ts +30 -4
- package/templates/current/clean/src/router/queryEncryption.ts +48 -44
- package/templates/current/clean/src/router/useRouteQueryDefaults.spec.ts +2 -1
- package/templates/current/clean/src/router/useRouteQueryDefaults.types.ts +2 -1
- package/templates/current/clean/src/templates/og-table.ts +81 -37
- package/templates/current/clean/src/templates/templates.spec.ts +19 -0
- package/templates/current/clean/vite.build-policy.ts +114 -289
- package/templates/current/clean/vite.config.ts +4 -5
- package/templates/current/examples/CHANGELOG.md +34 -0
- package/templates/current/examples/component-catalog.json +9 -9
- package/templates/current/examples/package.json +41 -41
- package/templates/current/examples/scaffold.lock.json +2 -2
- package/templates/current/examples/scripts/vite-build-policy.spec.ts +71 -0
- package/templates/current/examples/src/App.vue +10 -3
- package/templates/current/examples/src/api/client.ts +90 -10
- package/templates/current/examples/src/api/generated/data-contracts.ts +3 -3
- package/templates/current/examples/src/api/generated/http-client.ts +1 -1
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/206/205/345/256/271/346/226/207/347/253/240.ts +1 -1
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/345/256/241/350/256/241.ts +1 -1
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/346/226/207/344/273/266/344/270/212/344/274/240.ts +1 -1
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/347/224/250/346/210/267.ts +2 -3
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/217/234/345/215/225.ts +3 -5
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/247/222/350/211/262.ts +2 -3
- package/templates/current/examples/src/api/generated//347/263/273/347/273/237/347/256/241/347/220/206/350/256/242/345/215/225/350/215/211/347/250/277.ts +2 -3
- package/templates/current/examples/src/api/generated//350/256/244/350/257/201.ts +1 -1
- package/templates/current/examples/src/app/adminLocale.ts +90 -0
- package/templates/current/examples/src/app/createAdminUi.spec.ts +65 -9
- package/templates/current/examples/src/app/createAdminUi.ts +14 -29
- package/templates/current/examples/src/app/embedded-token.spec.ts +40 -0
- package/templates/current/examples/src/app/embedded.spec.ts +135 -0
- package/templates/current/examples/src/app/embedded.ts +255 -0
- package/templates/current/examples/src/app/localeFormat.ts +52 -0
- package/templates/current/examples/src/app/menu.spec.ts +26 -0
- package/templates/current/examples/src/app/menu.ts +4 -0
- package/templates/current/examples/src/app/menuTypes.ts +1 -0
- package/templates/current/examples/src/app/origenUiLocale.spec.ts +6 -5
- package/templates/current/examples/src/app/origenUiLocale.ts +3 -58
- package/templates/current/examples/src/app/permission.spec.ts +26 -0
- package/templates/current/examples/src/app/runtimeConfig.ts +8 -7
- package/templates/current/examples/src/env.d.ts +18 -0
- package/templates/current/examples/src/features/appearance/components/ThemePanel.vue +21 -17
- package/templates/current/examples/src/features/appearance/store/theme.ts +2 -1
- package/templates/current/examples/src/features/auth/pages/Login.vue +15 -11
- package/templates/current/examples/src/features/auth/store/auth.ts +13 -3
- package/templates/current/examples/src/features/errors/pages/Forbidden.vue +6 -2
- package/templates/current/examples/src/features/errors/pages/NotFound.vue +6 -2
- package/templates/current/examples/src/features/errors/pages/ServerError.vue +6 -2
- package/templates/current/examples/src/features/errors/pages/error-pages.spec.ts +9 -1
- package/templates/current/examples/src/features/feature-composables.spec.ts +36 -9
- package/templates/current/examples/src/features/security/components/DevtoolsProtectionOverlay.vue +5 -2
- package/templates/current/examples/src/features/security/devtoolsProtection.spec.ts +7 -10
- package/templates/current/examples/src/features/security/devtoolsProtection.ts +2 -1
- package/templates/current/examples/src/features/system/access/api/admin-repository.spec.ts +14 -0
- package/templates/current/examples/src/features/system/access/api/admin-repository.ts +38 -15
- package/templates/current/examples/src/features/system/access/api/rbac.ts +37 -27
- package/templates/current/examples/src/features/system/audit/composables/useAuditManagement.ts +43 -38
- package/templates/current/examples/src/features/system/menus/components/MenuEditorForm.vue +33 -30
- package/templates/current/examples/src/features/system/menus/composables/useMenuManagement.ts +81 -69
- package/templates/current/examples/src/features/system/menus/pages/MenuList.vue +3 -1
- package/templates/current/examples/src/features/system/roles/components/RoleEditorForm.vue +18 -15
- package/templates/current/examples/src/features/system/roles/composables/useRoleManagement.ts +49 -53
- package/templates/current/examples/src/features/system/roles/pages/RoleList.vue +3 -1
- package/templates/current/examples/src/features/system/users/components/UserEditorForm.vue +22 -19
- package/templates/current/examples/src/features/system/users/composables/useUserManagement.ts +59 -64
- package/templates/current/examples/src/features/system/users/pages/UserList.vue +3 -1
- package/templates/current/examples/src/features/workspace/pages/Dashboard.spec.ts +9 -0
- package/templates/current/examples/src/features/workspace/pages/Dashboard.vue +54 -26
- package/templates/current/examples/src/features/workspace/pages/Empty.vue +4 -1
- package/templates/current/examples/src/features/workspace/pages/Profile.vue +13 -11
- package/templates/current/examples/src/layouts/AdminLayout.vue +3 -1
- package/templates/current/examples/src/layouts/TopBar.vue +26 -8
- package/templates/current/examples/src/locales/en-US.json +490 -0
- package/templates/current/examples/src/locales/en-US.runtime.ts +20 -0
- package/templates/current/examples/src/locales/index.ts +129 -45
- package/templates/current/examples/src/locales/messages-types.ts +62 -0
- package/templates/current/examples/src/locales/messages.spec.ts +113 -6
- package/templates/current/examples/src/locales/vue-i18n.d.ts +5 -0
- package/templates/current/examples/src/locales/zh-CN.json +490 -0
- package/templates/current/examples/src/locales/zh-CN.runtime.ts +20 -0
- package/templates/current/examples/src/locales/zh-TW.json +490 -0
- package/templates/current/examples/src/locales/zh-TW.runtime.ts +20 -0
- package/templates/current/examples/src/main.ts +31 -5
- package/templates/current/examples/src/router/bootstrap.ts +22 -7
- package/templates/current/examples/src/router/dynamicRoutes.spec.ts +17 -0
- package/templates/current/examples/src/router/dynamicRoutes.ts +5 -1
- package/templates/current/examples/src/router/queryEncryption.spec.ts +30 -4
- package/templates/current/examples/src/router/queryEncryption.ts +48 -44
- package/templates/current/examples/src/router/staticRoutes.ts +1 -1
- package/templates/current/examples/src/router/useRouteQueryDefaults.spec.ts +2 -1
- package/templates/current/examples/src/router/useRouteQueryDefaults.types.ts +2 -1
- package/templates/current/examples/src/templates/og-table.ts +81 -37
- package/templates/current/examples/src/templates/templates.spec.ts +19 -0
- package/templates/current/examples/vite.build-policy.ts +114 -289
- package/templates/current/examples/vite.config.ts +4 -5
- package/templates/current/clean/scripts/check-admin-bundle.mjs +0 -214
- package/templates/current/clean/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +0 -38
- package/templates/current/clean/src/locales/en-US.ts +0 -55
- package/templates/current/clean/src/locales/zh-CN.ts +0 -55
- package/templates/current/clean/src/locales/zh-TW.ts +0 -44
- package/templates/current/examples/scripts/check-admin-bundle.mjs +0 -214
- package/templates/current/examples/scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json +0 -38
- package/templates/current/examples/src/locales/en-US.ts +0 -55
- package/templates/current/examples/src/locales/zh-CN.ts +0 -55
- package/templates/current/examples/src/locales/zh-TW.ts +0 -44
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import type { Plugin,
|
|
1
|
+
import type { Plugin, Rolldown, UserConfig } from 'vite'
|
|
2
2
|
import { writeFile } from 'node:fs/promises'
|
|
3
3
|
import { resolve } from 'node:path'
|
|
4
4
|
import process from 'node:process'
|
|
5
5
|
|
|
6
6
|
const packageBuildDirectories = new Set(['dist', 'es', 'esm', 'lib', 'src'])
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
const MAX_INITIAL_VENDOR_CHUNK_BYTES = 300 * 1024
|
|
8
|
+
const MAX_ASYNC_VENDOR_CHUNK_BYTES = 400 * 1024
|
|
9
|
+
|
|
10
|
+
type AdminCodeSplitting = Exclude<
|
|
11
|
+
NonNullable<Rolldown.OutputOptions['codeSplitting']>,
|
|
12
|
+
boolean
|
|
13
|
+
>
|
|
10
14
|
|
|
11
15
|
function chunkName(value: string): string {
|
|
12
16
|
return value
|
|
@@ -51,294 +55,103 @@ function isStyleModule(id: string): boolean {
|
|
|
51
55
|
return /\.(?:css|less|sass|scss|styl)(?:$|\?)/.test(id)
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const [directory, moduleName] = location.path
|
|
58
|
-
if (!directory || !splitModuleDirectories.has(directory)) return location.name
|
|
59
|
-
if (directory === 'components' && moduleName)
|
|
60
|
-
return `${location.name}\0${directory}\0${moduleName}`
|
|
61
|
-
return `${location.name}\0${directory}`
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function stableHash(value: string): string {
|
|
65
|
-
let hash = 2_166_136_261
|
|
66
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
67
|
-
hash ^= value.charCodeAt(index)
|
|
68
|
-
hash = Math.imul(hash, 16_777_619)
|
|
69
|
-
}
|
|
70
|
-
return (hash >>> 0).toString(36)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function dynamicRootLabels(ids: readonly string[]): ReadonlyMap<string, string> {
|
|
74
|
-
const used = new Map<string, number>()
|
|
75
|
-
const labels = new Map<string, string>()
|
|
76
|
-
for (const id of [...ids].sort()) {
|
|
77
|
-
const normalized = id.split('?')[0].replaceAll('\\', '/')
|
|
78
|
-
const filename = normalized.slice(normalized.lastIndexOf('/') + 1).replace(/\.[^.]+$/, '')
|
|
79
|
-
const base = chunkName(filename || 'async') || 'async'
|
|
80
|
-
const count = (used.get(base) ?? 0) + 1
|
|
81
|
-
used.set(base, count)
|
|
82
|
-
labels.set(id, count === 1 ? base : `${base}-${count}`)
|
|
83
|
-
}
|
|
84
|
-
return labels
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function moduleOwners(
|
|
88
|
-
meta: Parameters<Rollup.GetManualChunk>[1],
|
|
89
|
-
): ReadonlyMap<string, readonly string[]> {
|
|
90
|
-
const ids = [...meta.getModuleIds()].sort()
|
|
91
|
-
const ownerSets = new Map<string, Set<string>>()
|
|
92
|
-
const entryRoots = ids.filter((id) => meta.getModuleInfo(id)?.isEntry)
|
|
93
|
-
const dynamicRoots = [
|
|
94
|
-
...new Set(ids.flatMap((id) => meta.getModuleInfo(id)?.dynamicallyImportedIds ?? [])),
|
|
95
|
-
]
|
|
96
|
-
const labels = dynamicRootLabels(dynamicRoots)
|
|
97
|
-
|
|
98
|
-
function markStaticClosure(root: string, owner: string): void {
|
|
99
|
-
const stack = [root]
|
|
100
|
-
while (stack.length > 0) {
|
|
101
|
-
const id = stack.pop()!
|
|
102
|
-
const info = meta.getModuleInfo(id)
|
|
103
|
-
if (!info || info.isExternal) continue
|
|
104
|
-
const owners = ownerSets.get(id) ?? new Set<string>()
|
|
105
|
-
if (owners.has(owner)) continue
|
|
106
|
-
owners.add(owner)
|
|
107
|
-
ownerSets.set(id, owners)
|
|
108
|
-
stack.push(...info.importedIds)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
for (const root of entryRoots) markStaticClosure(root, 'entry')
|
|
113
|
-
for (const root of dynamicRoots) markStaticClosure(root, labels.get(root) ?? 'async')
|
|
114
|
-
|
|
115
|
-
return new Map([...ownerSets].map(([id, owners]) => [id, [...owners].sort()]))
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function asyncOwnerLabel(owners: readonly string[]): string {
|
|
119
|
-
const asyncOwners = owners.filter((owner) => owner !== 'entry')
|
|
120
|
-
if (asyncOwners.length === 0) return 'orphan'
|
|
121
|
-
if (asyncOwners.length === 1) return asyncOwners[0]
|
|
122
|
-
return `shared-${stableHash(asyncOwners.join('|'))}`
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function isInitialOnly(owners: readonly string[]): boolean {
|
|
126
|
-
return owners.length === 1 && owners[0] === 'entry'
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function stronglyConnectedComponents(units: Map<string, { edges: Set<string> }>): string[][] {
|
|
130
|
-
const indices = new Map<string, number>()
|
|
131
|
-
const lowLinks = new Map<string, number>()
|
|
132
|
-
const stack: string[] = []
|
|
133
|
-
const stacked = new Set<string>()
|
|
134
|
-
const components: string[][] = []
|
|
135
|
-
let index = 0
|
|
136
|
-
|
|
137
|
-
function visit(key: string) {
|
|
138
|
-
indices.set(key, index)
|
|
139
|
-
lowLinks.set(key, index++)
|
|
140
|
-
stack.push(key)
|
|
141
|
-
stacked.add(key)
|
|
142
|
-
|
|
143
|
-
for (const edge of [...(units.get(key)?.edges ?? [])].sort()) {
|
|
144
|
-
if (!units.has(edge)) continue
|
|
145
|
-
if (!indices.has(edge)) {
|
|
146
|
-
visit(edge)
|
|
147
|
-
lowLinks.set(key, Math.min(lowLinks.get(key)!, lowLinks.get(edge)!))
|
|
148
|
-
} else if (stacked.has(edge)) {
|
|
149
|
-
lowLinks.set(key, Math.min(lowLinks.get(key)!, indices.get(edge)!))
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (lowLinks.get(key) !== indices.get(key)) return
|
|
154
|
-
const component: string[] = []
|
|
155
|
-
let member: string
|
|
156
|
-
do {
|
|
157
|
-
member = stack.pop()!
|
|
158
|
-
stacked.delete(member)
|
|
159
|
-
component.push(member)
|
|
160
|
-
} while (member !== key)
|
|
161
|
-
components.push(component.sort())
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
for (const key of [...units.keys()].sort()) {
|
|
165
|
-
if (!indices.has(key)) visit(key)
|
|
166
|
-
}
|
|
167
|
-
return components
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function topologicallyOrderedComponents(units: Map<string, { edges: Set<string> }>): string[][] {
|
|
171
|
-
const components = stronglyConnectedComponents(units)
|
|
172
|
-
const componentByUnit = new Map<string, number>()
|
|
173
|
-
components.forEach((component, index) => {
|
|
174
|
-
for (const key of component) componentByUnit.set(key, index)
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
const edges = components.map(() => new Set<number>())
|
|
178
|
-
const indegrees = components.map(() => 0)
|
|
179
|
-
for (const [unit, value] of units) {
|
|
180
|
-
const from = componentByUnit.get(unit)!
|
|
181
|
-
for (const dependency of value.edges) {
|
|
182
|
-
const to = componentByUnit.get(dependency)
|
|
183
|
-
if (to === undefined || to === from || edges[from].has(to)) continue
|
|
184
|
-
edges[from].add(to)
|
|
185
|
-
indegrees[to] += 1
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const available = components
|
|
190
|
-
.map((_, index) => index)
|
|
191
|
-
.filter((index) => indegrees[index] === 0)
|
|
192
|
-
.sort((left, right) => components[left].join('\0').localeCompare(components[right].join('\0')))
|
|
193
|
-
const ordered: string[][] = []
|
|
194
|
-
while (available.length > 0) {
|
|
195
|
-
const index = available.shift()!
|
|
196
|
-
ordered.push(components[index])
|
|
197
|
-
for (const dependency of edges[index]) {
|
|
198
|
-
indegrees[dependency] -= 1
|
|
199
|
-
if (indegrees[dependency] === 0) {
|
|
200
|
-
available.push(dependency)
|
|
201
|
-
available.sort((left, right) =>
|
|
202
|
-
components[left].join('\0').localeCompare(components[right].join('\0')),
|
|
203
|
-
)
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return ordered
|
|
58
|
+
function vendorLocation(id: string) {
|
|
59
|
+
if (id.startsWith('\0') || isStyleModule(id)) return undefined
|
|
60
|
+
return moduleLocation(id)
|
|
208
61
|
}
|
|
209
62
|
|
|
210
|
-
function
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
): ReadonlyMap<string, string> {
|
|
214
|
-
const components = topologicallyOrderedComponents(units)
|
|
215
|
-
const totalSize = components.reduce(
|
|
216
|
-
(total, component) => total + component.reduce((size, key) => size + units.get(key)!.size, 0),
|
|
217
|
-
0,
|
|
218
|
-
)
|
|
219
|
-
const assignments = new Map<string, string>()
|
|
220
|
-
let consumedSize = 0
|
|
221
|
-
for (const component of components) {
|
|
222
|
-
const componentSize = component.reduce((size, key) => size + units.get(key)!.size, 0)
|
|
223
|
-
const midpoint = consumedSize + componentSize / 2
|
|
224
|
-
const bucket = Math.min(
|
|
225
|
-
Math.floor((midpoint * bucketCount) / Math.max(totalSize, 1)),
|
|
226
|
-
bucketCount - 1,
|
|
227
|
-
)
|
|
228
|
-
for (const key of component) assignments.set(key, String(bucket))
|
|
229
|
-
consumedSize += componentSize
|
|
230
|
-
}
|
|
231
|
-
return assignments
|
|
63
|
+
function matchesPackageFamily(id: string, names: readonly string[]): boolean {
|
|
64
|
+
const name = vendorLocation(id)?.name
|
|
65
|
+
return Boolean(name && names.some((candidate) => name === candidate || name.startsWith(`${candidate}/`)))
|
|
232
66
|
}
|
|
233
67
|
|
|
234
|
-
function
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
): ReadonlyMap<string, string> {
|
|
238
|
-
const units = new Map<string, { edges: Set<string>, size: number }>()
|
|
239
|
-
const unitByModule = new Map<string, string>()
|
|
240
|
-
|
|
241
|
-
for (const id of [...meta.getModuleIds()].sort()) {
|
|
242
|
-
if (!isInitialOnly(owners.get(id) ?? [])) continue
|
|
243
|
-
const key = moduleUnitKey(id)
|
|
244
|
-
if (!key) continue
|
|
245
|
-
const unit = units.get(key) ?? { edges: new Set(), size: 0 }
|
|
246
|
-
unit.size += meta.getModuleInfo(id)?.code?.length ?? 1
|
|
247
|
-
units.set(key, unit)
|
|
248
|
-
unitByModule.set(id, key)
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
for (const [id, key] of unitByModule) {
|
|
252
|
-
for (const importedId of meta.getModuleInfo(id)?.importedIds ?? []) {
|
|
253
|
-
const importedKey = unitByModule.get(importedId)
|
|
254
|
-
if (importedKey && importedKey !== key) units.get(key)!.edges.add(importedKey)
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const unitAssignments = assignBuckets(units, INITIAL_CHUNK_BUCKETS)
|
|
259
|
-
return new Map([...unitByModule].map(([id, key]) => [id, unitAssignments.get(key) ?? '0']))
|
|
68
|
+
function matchesPackageEntry(id: string, packageName: string, entry: string): boolean {
|
|
69
|
+
const location = vendorLocation(id)
|
|
70
|
+
return location?.name === packageName && location.path[0] === entry
|
|
260
71
|
}
|
|
261
72
|
|
|
262
|
-
function
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
):
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const moduleOwners = owners.get(id) ?? []
|
|
272
|
-
if (isInitialOnly(moduleOwners) || location?.path[0] !== 'components' || !location.path[1])
|
|
273
|
-
continue
|
|
274
|
-
const group = `${asyncOwnerLabel(moduleOwners)}\0${location.name}`
|
|
275
|
-
const key = `${group}\0${location.path[1]}`
|
|
276
|
-
const units = unitsByGroup.get(group) ?? new Map()
|
|
277
|
-
const unit = units.get(key) ?? { edges: new Set<string>(), size: 0 }
|
|
278
|
-
unit.size += meta.getModuleInfo(id)?.code?.length ?? 1
|
|
279
|
-
units.set(key, unit)
|
|
280
|
-
unitsByGroup.set(group, units)
|
|
281
|
-
const modules = modulesByGroup.get(group) ?? new Map()
|
|
282
|
-
modules.set(id, key)
|
|
283
|
-
modulesByGroup.set(group, modules)
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
const assignments = new Map<string, string>()
|
|
287
|
-
for (const [group, modules] of modulesByGroup) {
|
|
288
|
-
const units = unitsByGroup.get(group)!
|
|
289
|
-
for (const [id, key] of modules) {
|
|
290
|
-
for (const importedId of meta.getModuleInfo(id)?.importedIds ?? []) {
|
|
291
|
-
const importedKey = modules.get(importedId)
|
|
292
|
-
if (importedKey && importedKey !== key) units.get(key)!.edges.add(importedKey)
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
const buckets = assignBuckets(units, ASYNC_COMPONENT_CHUNK_BUCKETS)
|
|
296
|
-
for (const [id, key] of modules) assignments.set(id, buckets.get(key) ?? '0')
|
|
297
|
-
}
|
|
298
|
-
return assignments
|
|
73
|
+
function dynamicPackageGroup(
|
|
74
|
+
id: string,
|
|
75
|
+
directory?: 'components' | 'languages' | 'locale',
|
|
76
|
+
): string | undefined {
|
|
77
|
+
const location = vendorLocation(id)
|
|
78
|
+
if (!location || location.name === 'element-plus') return undefined
|
|
79
|
+
if (directory && location.path[0] !== directory) return undefined
|
|
80
|
+
const suffix = directory === 'components' ? '-components' : directory ? `-${chunkName(directory)}` : ''
|
|
81
|
+
return `vendor-${chunkName(location.name)}${suffix}`
|
|
299
82
|
}
|
|
300
83
|
|
|
301
|
-
export function
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
84
|
+
export function createAdminCodeSplitting(): AdminCodeSplitting {
|
|
85
|
+
return {
|
|
86
|
+
groups: [
|
|
87
|
+
{
|
|
88
|
+
name: 'vendor-vue-runtime',
|
|
89
|
+
test: (id) => matchesPackageFamily(id, ['vue', '@vue']),
|
|
90
|
+
priority: 100,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'vendor-vue-i18n',
|
|
94
|
+
test: (id) => matchesPackageFamily(id, ['vue-i18n', '@intlify']),
|
|
95
|
+
priority: 95,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'vendor-vueuse',
|
|
99
|
+
test: (id) => matchesPackageFamily(id, ['@vueuse']),
|
|
100
|
+
priority: 90,
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'vendor-positioning',
|
|
104
|
+
test: (id) => matchesPackageFamily(id, ['@floating-ui', '@sxzz/popperjs-es']),
|
|
105
|
+
priority: 85,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'vendor-table-suite',
|
|
109
|
+
test: (id) =>
|
|
110
|
+
matchesPackageFamily(id, [
|
|
111
|
+
'og-table',
|
|
112
|
+
'og-table-search',
|
|
113
|
+
'og-search',
|
|
114
|
+
'@origen-ui/table',
|
|
115
|
+
'@origen-ui/table-search',
|
|
116
|
+
'@origen-ui/search',
|
|
117
|
+
]) ||
|
|
118
|
+
matchesPackageEntry(id, 'origen-ui', 'table') ||
|
|
119
|
+
matchesPackageEntry(id, 'origen-ui', 'table-search') ||
|
|
120
|
+
matchesPackageEntry(id, 'origen-ui', 'search'),
|
|
121
|
+
// Rolldown can otherwise split this mutually dependent family into a
|
|
122
|
+
// circular chunk-evaluation edge before Element Plus initializes.
|
|
123
|
+
priority: 80,
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: 'vendor-initial',
|
|
127
|
+
test: (id) => Boolean(vendorLocation(id)),
|
|
128
|
+
tags: ['$initial'],
|
|
129
|
+
maxSize: MAX_INITIAL_VENDOR_CHUNK_BYTES,
|
|
130
|
+
priority: 60,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: (id) => dynamicPackageGroup(id, 'components'),
|
|
134
|
+
entriesAware: true,
|
|
135
|
+
maxSize: MAX_ASYNC_VENDOR_CHUNK_BYTES,
|
|
136
|
+
priority: 50,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: (id) => dynamicPackageGroup(id, 'languages'),
|
|
140
|
+
entriesAware: true,
|
|
141
|
+
priority: 40,
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: (id) => dynamicPackageGroup(id, 'locale'),
|
|
145
|
+
entriesAware: true,
|
|
146
|
+
priority: 40,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: (id) => dynamicPackageGroup(id),
|
|
150
|
+
entriesAware: true,
|
|
151
|
+
maxSize: MAX_ASYNC_VENDOR_CHUNK_BYTES,
|
|
152
|
+
priority: 30,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
342
155
|
}
|
|
343
156
|
}
|
|
344
157
|
|
|
@@ -347,7 +160,9 @@ function normalizeEmptyChunks(): Plugin {
|
|
|
347
160
|
name: 'admin-normalize-empty-chunks',
|
|
348
161
|
renderChunk(code) {
|
|
349
162
|
const payload = code.replaceAll(/\/\*[\s\S]*?\*\//g, '').trim()
|
|
350
|
-
if (!payload || /^export\s*\{\s*\}\s*;?$/.test(payload))
|
|
163
|
+
if (!payload || /^export\s*\{\s*\}\s*;?$/.test(payload)) {
|
|
164
|
+
return { code: 'void 0;\n', map: { mappings: '' } }
|
|
165
|
+
}
|
|
351
166
|
return null
|
|
352
167
|
},
|
|
353
168
|
generateBundle(_options, bundle) {
|
|
@@ -382,10 +197,12 @@ export function createAdminBuildOptions(isDebugBuild: boolean): UserConfig['buil
|
|
|
382
197
|
return {
|
|
383
198
|
outDir: 'dist',
|
|
384
199
|
sourcemap: isDebugBuild,
|
|
385
|
-
|
|
200
|
+
// Keep the oxc minifier: it honours the `oxc.dropConsole` production
|
|
201
|
+
// policy, while overriding the minifier would silently keep console calls.
|
|
202
|
+
minify: !isDebugBuild,
|
|
386
203
|
target: 'es2020',
|
|
387
204
|
modulePreload: false,
|
|
388
|
-
|
|
205
|
+
rolldownOptions: {
|
|
389
206
|
onwarn(warning, warn) {
|
|
390
207
|
if (warning.code === 'EMPTY_BUNDLE') return
|
|
391
208
|
if (
|
|
@@ -397,8 +214,16 @@ export function createAdminBuildOptions(isDebugBuild: boolean): UserConfig['buil
|
|
|
397
214
|
warn(warning)
|
|
398
215
|
},
|
|
399
216
|
output: {
|
|
400
|
-
|
|
401
|
-
|
|
217
|
+
codeSplitting: createAdminCodeSplitting(),
|
|
218
|
+
...(!isDebugBuild
|
|
219
|
+
? {
|
|
220
|
+
minify: {
|
|
221
|
+
compress: { dropConsole: true, dropDebugger: true },
|
|
222
|
+
mangle: true,
|
|
223
|
+
codegen: true,
|
|
224
|
+
},
|
|
225
|
+
}
|
|
226
|
+
: {}),
|
|
402
227
|
},
|
|
403
228
|
},
|
|
404
229
|
}
|
|
@@ -7,7 +7,7 @@ import { loadEnv } from 'vite'
|
|
|
7
7
|
import { defineConfig } from 'vitest/config'
|
|
8
8
|
// This file is copied to the scaffold root, where the shared policy is copied
|
|
9
9
|
// with the application source as ./vite.build-policy.ts.
|
|
10
|
-
import { createAdminBuildOptions, createAdminBuildPlugins } from './vite.build-policy'
|
|
10
|
+
import { createAdminBuildOptions, createAdminBuildPlugins } from './vite.build-policy.js'
|
|
11
11
|
|
|
12
12
|
export default defineConfig(({ command, mode }) => {
|
|
13
13
|
const loadedEnv = loadEnv(mode, process.cwd(), '')
|
|
@@ -17,10 +17,9 @@ export default defineConfig(({ command, mode }) => {
|
|
|
17
17
|
return {
|
|
18
18
|
plugins: [vue(), vueJsx(), ...createAdminBuildPlugins(), ElementPlus({ useSource: true })],
|
|
19
19
|
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
|
|
20
|
-
|
|
21
|
-
jsx: '
|
|
22
|
-
|
|
23
|
-
...(command === 'build' && !isDebugBuild ? { drop: ['console', 'debugger'] } : {}),
|
|
20
|
+
oxc: {
|
|
21
|
+
jsx: { runtime: 'automatic', importSource: 'vue' },
|
|
22
|
+
...(command === 'build' && !isDebugBuild ? { dropConsole: true, dropDebugger: true } : {}),
|
|
24
23
|
},
|
|
25
24
|
server: {
|
|
26
25
|
port: 5175,
|
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @origen-ui/admin
|
|
2
2
|
|
|
3
|
+
## 1.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [f8fa05d]
|
|
8
|
+
- Updated dependencies [35487cf]
|
|
9
|
+
- Updated dependencies [a6ecb91]
|
|
10
|
+
- Updated dependencies [37da328]
|
|
11
|
+
- Updated dependencies [35487cf]
|
|
12
|
+
- Updated dependencies [0c985fd]
|
|
13
|
+
- Updated dependencies [35487cf]
|
|
14
|
+
- Updated dependencies [37da328]
|
|
15
|
+
- Updated dependencies [ed3e4b6]
|
|
16
|
+
- Updated dependencies [15b5342]
|
|
17
|
+
- Updated dependencies [35487cf]
|
|
18
|
+
- Updated dependencies [35487cf]
|
|
19
|
+
- Updated dependencies [35487cf]
|
|
20
|
+
- Updated dependencies [bf61dac]
|
|
21
|
+
- Updated dependencies [35487cf]
|
|
22
|
+
- Updated dependencies [0c985fd]
|
|
23
|
+
- origen-ui@1.1.0
|
|
24
|
+
- @origen-ui/router@1.1.0
|
|
25
|
+
- @origen-ui/form@1.1.0
|
|
26
|
+
- @origen-ui/tabs@1.1.0
|
|
27
|
+
- @origen-ui/upload@1.1.0
|
|
28
|
+
- @origen-ui/dialog@1.1.0
|
|
29
|
+
- @origen-ui/editor@1.1.0
|
|
30
|
+
- @origen-ui/search@1.1.0
|
|
31
|
+
- @origen-ui/table@1.1.0
|
|
32
|
+
- @origen-ui/table-search@1.1.0
|
|
33
|
+
- @origen-ui/shared@1.1.0
|
|
34
|
+
- @origen-ui/permission@1.1.0
|
|
35
|
+
- @origen-ui/http@1.1.0
|
|
36
|
+
|
|
3
37
|
## 1.0.3
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"mode": "prop-bag-and-expose",
|
|
52
52
|
"surface": "dialogProps, drawerProps, getSurfaceInstance"
|
|
53
53
|
},
|
|
54
|
-
"compatibilityVersion": "
|
|
54
|
+
"compatibilityVersion": "2.14.5"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
{
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"mode": "expose",
|
|
142
142
|
"surface": "OgEditorExpose.getEditor"
|
|
143
143
|
},
|
|
144
|
-
"compatibilityVersion": "
|
|
144
|
+
"compatibilityVersion": "2.14.5"
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
147
|
{
|
|
@@ -229,7 +229,7 @@
|
|
|
229
229
|
"mode": "prop-bag-and-expose",
|
|
230
230
|
"surface": "formProps, formRef"
|
|
231
231
|
},
|
|
232
|
-
"compatibilityVersion": "
|
|
232
|
+
"compatibilityVersion": "2.14.5"
|
|
233
233
|
}
|
|
234
234
|
},
|
|
235
235
|
{
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
"mode": "prop-bag-and-expose",
|
|
333
333
|
"surface": "formProps, formRef"
|
|
334
334
|
},
|
|
335
|
-
"compatibilityVersion": "
|
|
335
|
+
"compatibilityVersion": "2.14.5"
|
|
336
336
|
},
|
|
337
337
|
"legacyTokens": [
|
|
338
338
|
"defaultExpanded",
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
"mode": "config-and-expose",
|
|
389
389
|
"surface": "config.virtual.enabled selects the surface; config.nativeTable.standard or config.nativeTable.virtual, getNativeTable"
|
|
390
390
|
},
|
|
391
|
-
"compatibilityVersion": "
|
|
391
|
+
"compatibilityVersion": "2.14.5"
|
|
392
392
|
},
|
|
393
393
|
"legacyTokens": [
|
|
394
394
|
"config.plugins",
|
|
@@ -542,7 +542,7 @@
|
|
|
542
542
|
"mode": "prop-bag-and-expose",
|
|
543
543
|
"surface": "tabsProps, getNativeTabs"
|
|
544
544
|
},
|
|
545
|
-
"compatibilityVersion": "
|
|
545
|
+
"compatibilityVersion": "2.14.5"
|
|
546
546
|
},
|
|
547
547
|
"legacyTokens": [
|
|
548
548
|
"allowActions",
|
|
@@ -597,7 +597,7 @@
|
|
|
597
597
|
"mode": "prop-bag-and-expose",
|
|
598
598
|
"surface": "uploadProps, getNativeUpload"
|
|
599
599
|
},
|
|
600
|
-
"compatibilityVersion": "
|
|
600
|
+
"compatibilityVersion": "2.14.5"
|
|
601
601
|
},
|
|
602
602
|
"legacyTokens": [
|
|
603
603
|
"withCredentials"
|
|
@@ -638,7 +638,7 @@
|
|
|
638
638
|
"unsupportedRoute": [
|
|
639
639
|
"Use ElFormItem directly for raw Element Plus form-item behavior outside OgForm context."
|
|
640
640
|
],
|
|
641
|
-
"compatibilityVersion": "
|
|
641
|
+
"compatibilityVersion": "2.14.5"
|
|
642
642
|
}
|
|
643
643
|
},
|
|
644
644
|
{
|
|
@@ -674,7 +674,7 @@
|
|
|
674
674
|
"unsupportedRoute": [
|
|
675
675
|
"Use the required Element Plus control directly when the schema renderer contract is not needed."
|
|
676
676
|
],
|
|
677
|
-
"compatibilityVersion": "
|
|
677
|
+
"compatibilityVersion": "2.14.5"
|
|
678
678
|
}
|
|
679
679
|
},
|
|
680
680
|
{
|