@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,214 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/** Verifies Admin build artifacts for release and controlled debug builds. */
|
|
3
|
-
|
|
4
|
-
import { access, readdir, readFile, stat } from 'node:fs/promises'
|
|
5
|
-
import { dirname, relative, resolve } from 'node:path'
|
|
6
|
-
import process from 'node:process'
|
|
7
|
-
import { fileURLToPath } from 'node:url'
|
|
8
|
-
import { gzipSync } from 'node:zlib'
|
|
9
|
-
|
|
10
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
11
|
-
const ROOT = resolve(__dirname, '..')
|
|
12
|
-
const MAX_CHUNK_BYTES = 500 * 1024
|
|
13
|
-
const MAX_CHUNK_COUNT = 140
|
|
14
|
-
const MAX_TOTAL_BYTES = 2_560 * 1024
|
|
15
|
-
const MAX_ENTRY_BYTES = 96 * 1024
|
|
16
|
-
const MAX_INITIAL_JS_BYTES = 900 * 1024
|
|
17
|
-
const MAX_INITIAL_JS_FILES = 24
|
|
18
|
-
const DEBUG_BUILD = process.argv.includes('--debug')
|
|
19
|
-
const GZIP_SAFETY_MARGIN_BYTES = 10 * 1024
|
|
20
|
-
const MAX_GZIP_BYTES = 502_650
|
|
21
|
-
const BUNDLE_BASELINE_PATH = resolve(
|
|
22
|
-
ROOT,
|
|
23
|
-
'scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json',
|
|
24
|
-
)
|
|
25
|
-
const MAX_GZIP_GROWTH = 0.05
|
|
26
|
-
const bundleBaseline = JSON.parse(await readFile(BUNDLE_BASELINE_PATH, 'utf8'))
|
|
27
|
-
const expectedGzipLimit = Math.floor(
|
|
28
|
-
bundleBaseline.admin.javaScriptGzipBytes * (1 + MAX_GZIP_GROWTH) - GZIP_SAFETY_MARGIN_BYTES,
|
|
29
|
-
)
|
|
30
|
-
if (MAX_GZIP_BYTES !== expectedGzipLimit) {
|
|
31
|
-
throw new Error(
|
|
32
|
-
`Admin gzip hard limit ${MAX_GZIP_BYTES} does not match the immutable baseline calculation ${expectedGzipLimit}.`,
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const appRoot = await applicationRoot()
|
|
37
|
-
const DIST_DIRECTORY = resolve(appRoot, 'dist')
|
|
38
|
-
const ASSETS_DIRECTORY = resolve(DIST_DIRECTORY, 'assets')
|
|
39
|
-
|
|
40
|
-
async function findJavaScriptChunks(directory, chunks = []) {
|
|
41
|
-
const entries = await readdir(directory, { withFileTypes: true })
|
|
42
|
-
for (const entry of entries) {
|
|
43
|
-
const path = resolve(directory, entry.name)
|
|
44
|
-
if (entry.isDirectory()) await findJavaScriptChunks(path, chunks)
|
|
45
|
-
else if (entry.isFile() && entry.name.endsWith('.js')) chunks.push(path)
|
|
46
|
-
}
|
|
47
|
-
return chunks
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function findSourceMaps(directory, maps = []) {
|
|
51
|
-
const entries = await readdir(directory, { withFileTypes: true })
|
|
52
|
-
for (const entry of entries) {
|
|
53
|
-
const path = resolve(directory, entry.name)
|
|
54
|
-
if (entry.isDirectory()) await findSourceMaps(path, maps)
|
|
55
|
-
else if (entry.isFile() && entry.name.endsWith('.map')) maps.push(path)
|
|
56
|
-
}
|
|
57
|
-
return maps
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function applicationRoot() {
|
|
61
|
-
const workspaceAdmin = resolve(ROOT, 'apps', 'admin')
|
|
62
|
-
try {
|
|
63
|
-
await access(workspaceAdmin)
|
|
64
|
-
return workspaceAdmin
|
|
65
|
-
} catch {
|
|
66
|
-
// The same checker is copied into an exported standalone Admin app.
|
|
67
|
-
return ROOT
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function containsExecutableDebugCode(source) {
|
|
72
|
-
return /\bdebugger\s*;|\bconsole\s*\.\s*(?:assert|clear|count|debug|dir|error|group|info|log|profile|table|time|trace|warn)\s*\(/.test(
|
|
73
|
-
source,
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function containsJavaScriptPayload(source) {
|
|
78
|
-
const withoutComments = source
|
|
79
|
-
.replaceAll(/\/\*[\s\S]*?\*\//g, '')
|
|
80
|
-
.replaceAll(/(^|\n)\s*\/\/[^\n]*/g, '$1')
|
|
81
|
-
.trim()
|
|
82
|
-
return withoutComments !== '' && !/^export\s*\{\s*\}\s*;?$/.test(withoutComments)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function formatKib(bytes) {
|
|
86
|
-
return `${(bytes / 1024).toFixed(1)} KiB`
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function assetPathFromUrl(url) {
|
|
90
|
-
const cleanUrl = url.split(/[?#]/, 1)[0].replaceAll('\\', '/')
|
|
91
|
-
const marker = 'assets/'
|
|
92
|
-
const markerIndex = cleanUrl.indexOf(marker)
|
|
93
|
-
if (markerIndex < 0 || !cleanUrl.endsWith('.js')) return undefined
|
|
94
|
-
const relativePath = cleanUrl.slice(markerIndex + marker.length)
|
|
95
|
-
if (!relativePath || relativePath.includes('../')) return undefined
|
|
96
|
-
return resolve(ASSETS_DIRECTORY, relativePath)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async function readInitialJavaScript() {
|
|
100
|
-
const html = await readFile(resolve(DIST_DIRECTORY, 'index.html'), 'utf8')
|
|
101
|
-
const initial = new Set()
|
|
102
|
-
const entries = new Set()
|
|
103
|
-
|
|
104
|
-
for (const match of html.matchAll(
|
|
105
|
-
/<(script|link)\s[^>]*(?:src|href)=["']([^"']+\.js(?:[?#][^"']*)?)["'][^>]*>/gi,
|
|
106
|
-
)) {
|
|
107
|
-
const path = assetPathFromUrl(match[2])
|
|
108
|
-
if (!path) continue
|
|
109
|
-
initial.add(path)
|
|
110
|
-
if (match[1].toLowerCase() === 'script') entries.add(path)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (entries.size === 0) throw new Error('Admin index.html does not reference a JavaScript entry.')
|
|
114
|
-
|
|
115
|
-
const sizes = await Promise.all(
|
|
116
|
-
[...initial].map(async (path) => ({ path, size: (await stat(path)).size })),
|
|
117
|
-
)
|
|
118
|
-
const entrySizes = sizes.filter(({ path }) => entries.has(path))
|
|
119
|
-
return {
|
|
120
|
-
entryBytes: entrySizes.reduce((total, { size }) => total + size, 0),
|
|
121
|
-
initialBytes: sizes.reduce((total, { size }) => total + size, 0),
|
|
122
|
-
initialFiles: sizes.length,
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async function main() {
|
|
127
|
-
const chunks = await findJavaScriptChunks(ASSETS_DIRECTORY)
|
|
128
|
-
if (chunks.length === 0) throw new Error('No JavaScript chunks were produced by the Admin build.')
|
|
129
|
-
|
|
130
|
-
const sourceMaps = await findSourceMaps(DIST_DIRECTORY)
|
|
131
|
-
if (DEBUG_BUILD) {
|
|
132
|
-
if (sourceMaps.length === 0) throw new Error('Debug build did not produce source maps.')
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (sourceMaps.length > 0) {
|
|
137
|
-
throw new Error('Production build produced source maps.')
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const artifacts = []
|
|
141
|
-
const empty = []
|
|
142
|
-
const debugCode = []
|
|
143
|
-
for (const chunk of chunks) {
|
|
144
|
-
const path = relative(ROOT, chunk)
|
|
145
|
-
const size = (await stat(chunk)).size
|
|
146
|
-
const source = await readFile(chunk, 'utf8')
|
|
147
|
-
artifacts.push({ path, size })
|
|
148
|
-
if (!containsJavaScriptPayload(source)) empty.push(path)
|
|
149
|
-
if (containsExecutableDebugCode(source)) debugCode.push(path)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
artifacts.sort((left, right) => right.size - left.size || left.path.localeCompare(right.path))
|
|
153
|
-
const oversized = artifacts.filter(({ size }) => size > MAX_CHUNK_BYTES)
|
|
154
|
-
const totalBytes = artifacts.reduce((total, { size }) => total + size, 0)
|
|
155
|
-
const totalGzipBytes = (
|
|
156
|
-
await Promise.all(chunks.map(async (chunk) => gzipSync(await readFile(chunk)).length))
|
|
157
|
-
).reduce((total, size) => total + size, 0)
|
|
158
|
-
const gzipHeadroomBytes = MAX_GZIP_BYTES - totalGzipBytes
|
|
159
|
-
const largest = artifacts[0]
|
|
160
|
-
const initial = await readInitialJavaScript()
|
|
161
|
-
|
|
162
|
-
console.log(
|
|
163
|
-
`[admin-bundle] ${artifacts.length} JavaScript chunks, ${formatKib(totalBytes)} total; ` +
|
|
164
|
-
`largest ${largest.path} (${formatKib(largest.size)}, ${Math.round((largest.size / MAX_CHUNK_BYTES) * 100)}% of budget); ` +
|
|
165
|
-
`entry ${formatKib(initial.entryBytes)}, initial ${initial.initialFiles} files / ${formatKib(initial.initialBytes)}; ` +
|
|
166
|
-
`gzip ${formatKib(totalGzipBytes)} / ${formatKib(MAX_GZIP_BYTES)} hard limit; ` +
|
|
167
|
-
`${formatKib(gzipHeadroomBytes)} headroom`,
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
if (oversized.length > 0) {
|
|
171
|
-
for (const { path, size } of oversized.sort((left, right) => right.size - left.size)) {
|
|
172
|
-
console.error(
|
|
173
|
-
`[admin-bundle] ${path}: ${formatKib(size)} exceeds the ${formatKib(MAX_CHUNK_BYTES)} budget`,
|
|
174
|
-
)
|
|
175
|
-
}
|
|
176
|
-
process.exitCode = 1
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (empty.length > 0) {
|
|
180
|
-
for (const path of empty.sort())
|
|
181
|
-
console.error(`[admin-bundle] ${path}: empty JavaScript chunk is not allowed`)
|
|
182
|
-
process.exitCode = 1
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const budgetFailures = [
|
|
186
|
-
artifacts.length > MAX_CHUNK_COUNT &&
|
|
187
|
-
`${artifacts.length} chunks exceeds the ${MAX_CHUNK_COUNT}-chunk budget`,
|
|
188
|
-
totalBytes > MAX_TOTAL_BYTES &&
|
|
189
|
-
`${formatKib(totalBytes)} total exceeds the ${formatKib(MAX_TOTAL_BYTES)} budget`,
|
|
190
|
-
initial.entryBytes > MAX_ENTRY_BYTES &&
|
|
191
|
-
`${formatKib(initial.entryBytes)} entry exceeds the ${formatKib(MAX_ENTRY_BYTES)} budget`,
|
|
192
|
-
initial.initialFiles > MAX_INITIAL_JS_FILES &&
|
|
193
|
-
`${initial.initialFiles} initial files exceeds the ${MAX_INITIAL_JS_FILES}-file budget`,
|
|
194
|
-
initial.initialBytes > MAX_INITIAL_JS_BYTES &&
|
|
195
|
-
`${formatKib(initial.initialBytes)} initial JavaScript exceeds the ${formatKib(MAX_INITIAL_JS_BYTES)} budget`,
|
|
196
|
-
totalGzipBytes > MAX_GZIP_BYTES &&
|
|
197
|
-
`${formatKib(totalGzipBytes)} JavaScript gzip exceeds the ${formatKib(MAX_GZIP_BYTES)} hard limit (5% historical growth less 10 KiB safety margin)`,
|
|
198
|
-
].filter(Boolean)
|
|
199
|
-
for (const failure of budgetFailures) {
|
|
200
|
-
console.error(`[admin-bundle] ${failure}`)
|
|
201
|
-
process.exitCode = 1
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (debugCode.length > 0) {
|
|
205
|
-
for (const path of debugCode)
|
|
206
|
-
console.error(`[admin-bundle] ${path}: executable console/debugger code is not allowed`)
|
|
207
|
-
process.exitCode = 1
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
main().catch((error) => {
|
|
212
|
-
console.error(`[admin-bundle] ${error.message}`)
|
|
213
|
-
process.exitCode = 1
|
|
214
|
-
})
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": 1,
|
|
3
|
-
"recordedAt": "2026-08-15T09:31:18.000Z",
|
|
4
|
-
"source": {
|
|
5
|
-
"commit": "ac962ddbcbd91470376194b95d2e6323db290277",
|
|
6
|
-
"description": "Production artifacts built before ae4ff1e unified public component entry points. Package values are the gzip sum of every published dist runtime artifact and declared root CSS asset. Baselines are immutable release evidence, not generated by the checker.",
|
|
7
|
-
"adminDistSha256": "4651bb36dcfa1d6bf93667409765fd85e4a2ee7e61592aee14ae0346e99445e6",
|
|
8
|
-
"docsDistSha256": "3a250df67f9ff3b46218972f9e2dff5d31a234bca4f4379add487b14d1fa8740"
|
|
9
|
-
},
|
|
10
|
-
"admin": {
|
|
11
|
-
"javaScriptGzipBytes": 488467
|
|
12
|
-
},
|
|
13
|
-
"docs": {
|
|
14
|
-
"javaScriptGzipBytes": 1023857
|
|
15
|
-
},
|
|
16
|
-
"packages": {
|
|
17
|
-
"http": 7081,
|
|
18
|
-
"icons": 78087,
|
|
19
|
-
"dialog": 17024,
|
|
20
|
-
"editor": 26511,
|
|
21
|
-
"form": 44729,
|
|
22
|
-
"form-table": 8348,
|
|
23
|
-
"search": 16676,
|
|
24
|
-
"table": 79906,
|
|
25
|
-
"table-search": 4713,
|
|
26
|
-
"tabs": 48200,
|
|
27
|
-
"origen-ui": 2206,
|
|
28
|
-
"upload": 17729,
|
|
29
|
-
"router": 15749,
|
|
30
|
-
"shared": 2901
|
|
31
|
-
},
|
|
32
|
-
"introducedAfterBaseline": {
|
|
33
|
-
"permission": "Added by ae4ff1e after the pre-entry-unification baseline; its first released artifact establishes the next baseline."
|
|
34
|
-
},
|
|
35
|
-
"nonBrowserRuntimePackages": {
|
|
36
|
-
"admin-cli": "The CLI publishes templates and Node scripts rather than browser runtime artifacts. Its generated Admin application is covered by the Admin bundle gates."
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { OG_DIALOG_LOCALE_EN_US } from '@origen-ui/dialog/locale'
|
|
2
|
-
import { OG_EDITOR_LOCALE_EN_US } from '@origen-ui/editor/locale'
|
|
3
|
-
import { OG_FORM_LOCALE_EN_US } from '@origen-ui/form/locale'
|
|
4
|
-
import { OG_SEARCH_LOCALE_EN_US } from '@origen-ui/search/locale'
|
|
5
|
-
import { OG_TABLE_LOCALE_EN_US } from '@origen-ui/table/locale'
|
|
6
|
-
import { OG_TABS_LOCALE_EN_US } from '@origen-ui/tabs/locale'
|
|
7
|
-
import { OG_UPLOAD_LOCALE_EN_US } from '@origen-ui/upload/locale'
|
|
8
|
-
import enElement from 'element-plus/es/locale/lang/en'
|
|
9
|
-
import { defineOrigenUiLanguage } from 'origen-ui/language'
|
|
10
|
-
|
|
11
|
-
const messages = {
|
|
12
|
-
app: {
|
|
13
|
-
title: 'Origen UI Admin Console',
|
|
14
|
-
},
|
|
15
|
-
menu: {
|
|
16
|
-
dashboard: 'Dashboard',
|
|
17
|
-
profile: 'Profile',
|
|
18
|
-
system: {
|
|
19
|
-
label: 'System',
|
|
20
|
-
userList: 'Users',
|
|
21
|
-
roleList: 'Roles',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
auth: {
|
|
25
|
-
login: 'Sign in',
|
|
26
|
-
logout: 'Sign out',
|
|
27
|
-
username: 'Username',
|
|
28
|
-
password: 'Password',
|
|
29
|
-
},
|
|
30
|
-
shell: {
|
|
31
|
-
applicationNavigation: 'Application navigation',
|
|
32
|
-
collapseNavigation: 'Collapse navigation',
|
|
33
|
-
expandNavigation: 'Expand navigation',
|
|
34
|
-
languageLoadFailed: 'Unable to load language. Please try again.',
|
|
35
|
-
openUserMenu: 'Open user menu',
|
|
36
|
-
preferences: 'Preferences',
|
|
37
|
-
searchMenu: 'Search menus or pages',
|
|
38
|
-
},
|
|
39
|
-
errors: { forbidden: 'Access denied', notFound: 'Page not found', server: 'Server error' },
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default defineOrigenUiLanguage({
|
|
43
|
-
locale: 'en-US',
|
|
44
|
-
messages,
|
|
45
|
-
elementPlus: enElement,
|
|
46
|
-
origenUi: {
|
|
47
|
-
dialog: OG_DIALOG_LOCALE_EN_US,
|
|
48
|
-
editor: OG_EDITOR_LOCALE_EN_US,
|
|
49
|
-
form: OG_FORM_LOCALE_EN_US,
|
|
50
|
-
search: OG_SEARCH_LOCALE_EN_US,
|
|
51
|
-
table: OG_TABLE_LOCALE_EN_US,
|
|
52
|
-
tabs: OG_TABS_LOCALE_EN_US,
|
|
53
|
-
upload: OG_UPLOAD_LOCALE_EN_US,
|
|
54
|
-
},
|
|
55
|
-
})
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { OG_DIALOG_LOCALE_ZH_CN } from '@origen-ui/dialog/locale'
|
|
2
|
-
import { OG_EDITOR_LOCALE_ZH_CN } from '@origen-ui/editor/locale'
|
|
3
|
-
import { OG_FORM_LOCALE_ZH_CN } from '@origen-ui/form/locale'
|
|
4
|
-
import { OG_SEARCH_LOCALE_ZH_CN } from '@origen-ui/search/locale'
|
|
5
|
-
import { OG_TABLE_LOCALE_ZH_CN } from '@origen-ui/table/locale'
|
|
6
|
-
import { OG_TABS_LOCALE_ZH_CN } from '@origen-ui/tabs/locale'
|
|
7
|
-
import { OG_UPLOAD_LOCALE_ZH_CN } from '@origen-ui/upload/locale'
|
|
8
|
-
import zhCnElement from 'element-plus/es/locale/lang/zh-cn'
|
|
9
|
-
import { defineOrigenUiLanguage } from 'origen-ui/language'
|
|
10
|
-
|
|
11
|
-
const messages = {
|
|
12
|
-
app: {
|
|
13
|
-
title: 'Origen UI Admin Console',
|
|
14
|
-
},
|
|
15
|
-
menu: {
|
|
16
|
-
dashboard: '仪表盘',
|
|
17
|
-
profile: '个人资料',
|
|
18
|
-
system: {
|
|
19
|
-
label: '系统管理',
|
|
20
|
-
userList: '用户管理',
|
|
21
|
-
roleList: '角色管理',
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
auth: {
|
|
25
|
-
login: '登录',
|
|
26
|
-
logout: '退出登录',
|
|
27
|
-
username: '账号',
|
|
28
|
-
password: '密码',
|
|
29
|
-
},
|
|
30
|
-
shell: {
|
|
31
|
-
applicationNavigation: '应用导航',
|
|
32
|
-
collapseNavigation: '折叠侧边栏',
|
|
33
|
-
expandNavigation: '展开侧边栏',
|
|
34
|
-
languageLoadFailed: '语言加载失败,请稍后重试',
|
|
35
|
-
openUserMenu: '打开用户菜单',
|
|
36
|
-
preferences: '偏好设置',
|
|
37
|
-
searchMenu: '搜索菜单或页面',
|
|
38
|
-
},
|
|
39
|
-
errors: { forbidden: '无权访问', notFound: '页面不存在', server: '服务异常' },
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default defineOrigenUiLanguage({
|
|
43
|
-
locale: 'zh-CN',
|
|
44
|
-
messages,
|
|
45
|
-
elementPlus: zhCnElement,
|
|
46
|
-
origenUi: {
|
|
47
|
-
dialog: OG_DIALOG_LOCALE_ZH_CN,
|
|
48
|
-
editor: OG_EDITOR_LOCALE_ZH_CN,
|
|
49
|
-
form: OG_FORM_LOCALE_ZH_CN,
|
|
50
|
-
search: OG_SEARCH_LOCALE_ZH_CN,
|
|
51
|
-
table: OG_TABLE_LOCALE_ZH_CN,
|
|
52
|
-
tabs: OG_TABS_LOCALE_ZH_CN,
|
|
53
|
-
upload: OG_UPLOAD_LOCALE_ZH_CN,
|
|
54
|
-
},
|
|
55
|
-
})
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { OG_DIALOG_LOCALE_ZH_TW } from '@origen-ui/dialog/locale'
|
|
2
|
-
import { OG_EDITOR_LOCALE_ZH_TW } from '@origen-ui/editor/locale'
|
|
3
|
-
import { OG_FORM_LOCALE_ZH_TW } from '@origen-ui/form/locale'
|
|
4
|
-
import { OG_SEARCH_LOCALE_ZH_TW } from '@origen-ui/search/locale'
|
|
5
|
-
import { OG_TABLE_LOCALE_ZH_TW } from '@origen-ui/table/locale'
|
|
6
|
-
import { OG_TABS_LOCALE_ZH_TW } from '@origen-ui/tabs/locale'
|
|
7
|
-
import { OG_UPLOAD_LOCALE_ZH_TW } from '@origen-ui/upload/locale'
|
|
8
|
-
import zhTwElement from 'element-plus/es/locale/lang/zh-tw'
|
|
9
|
-
import { defineOrigenUiLanguage } from 'origen-ui/language'
|
|
10
|
-
|
|
11
|
-
const messages = {
|
|
12
|
-
app: { title: '禾數營運控制台' },
|
|
13
|
-
menu: {
|
|
14
|
-
dashboard: '儀表板',
|
|
15
|
-
profile: '個人資料',
|
|
16
|
-
system: { label: '系統管理', userList: '使用者管理', roleList: '角色管理' },
|
|
17
|
-
},
|
|
18
|
-
auth: { login: '登入', logout: '登出', username: '帳號', password: '密碼' },
|
|
19
|
-
shell: {
|
|
20
|
-
applicationNavigation: '應用程式導覽',
|
|
21
|
-
collapseNavigation: '收合側邊欄',
|
|
22
|
-
expandNavigation: '展開側邊欄',
|
|
23
|
-
languageLoadFailed: '語言載入失敗,請稍後再試。',
|
|
24
|
-
openUserMenu: '開啟使用者選單',
|
|
25
|
-
preferences: '偏好設定',
|
|
26
|
-
searchMenu: '搜尋選單或頁面',
|
|
27
|
-
},
|
|
28
|
-
errors: { forbidden: '沒有存取權限', notFound: '找不到頁面', server: '服務錯誤' },
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export default defineOrigenUiLanguage({
|
|
32
|
-
locale: 'zh-TW',
|
|
33
|
-
messages,
|
|
34
|
-
elementPlus: zhTwElement,
|
|
35
|
-
origenUi: {
|
|
36
|
-
dialog: OG_DIALOG_LOCALE_ZH_TW,
|
|
37
|
-
editor: OG_EDITOR_LOCALE_ZH_TW,
|
|
38
|
-
form: OG_FORM_LOCALE_ZH_TW,
|
|
39
|
-
search: OG_SEARCH_LOCALE_ZH_TW,
|
|
40
|
-
table: OG_TABLE_LOCALE_ZH_TW,
|
|
41
|
-
tabs: OG_TABS_LOCALE_ZH_TW,
|
|
42
|
-
upload: OG_UPLOAD_LOCALE_ZH_TW,
|
|
43
|
-
},
|
|
44
|
-
})
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/** Verifies Admin build artifacts for release and controlled debug builds. */
|
|
3
|
-
|
|
4
|
-
import { access, readdir, readFile, stat } from 'node:fs/promises'
|
|
5
|
-
import { dirname, relative, resolve } from 'node:path'
|
|
6
|
-
import process from 'node:process'
|
|
7
|
-
import { fileURLToPath } from 'node:url'
|
|
8
|
-
import { gzipSync } from 'node:zlib'
|
|
9
|
-
|
|
10
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
11
|
-
const ROOT = resolve(__dirname, '..')
|
|
12
|
-
const MAX_CHUNK_BYTES = 500 * 1024
|
|
13
|
-
const MAX_CHUNK_COUNT = 140
|
|
14
|
-
const MAX_TOTAL_BYTES = 2_560 * 1024
|
|
15
|
-
const MAX_ENTRY_BYTES = 96 * 1024
|
|
16
|
-
const MAX_INITIAL_JS_BYTES = 900 * 1024
|
|
17
|
-
const MAX_INITIAL_JS_FILES = 24
|
|
18
|
-
const DEBUG_BUILD = process.argv.includes('--debug')
|
|
19
|
-
const GZIP_SAFETY_MARGIN_BYTES = 10 * 1024
|
|
20
|
-
const MAX_GZIP_BYTES = 502_650
|
|
21
|
-
const BUNDLE_BASELINE_PATH = resolve(
|
|
22
|
-
ROOT,
|
|
23
|
-
'scripts/performance/baselines/bundle-gzip-v2-pre-entry-unification.json',
|
|
24
|
-
)
|
|
25
|
-
const MAX_GZIP_GROWTH = 0.05
|
|
26
|
-
const bundleBaseline = JSON.parse(await readFile(BUNDLE_BASELINE_PATH, 'utf8'))
|
|
27
|
-
const expectedGzipLimit = Math.floor(
|
|
28
|
-
bundleBaseline.admin.javaScriptGzipBytes * (1 + MAX_GZIP_GROWTH) - GZIP_SAFETY_MARGIN_BYTES,
|
|
29
|
-
)
|
|
30
|
-
if (MAX_GZIP_BYTES !== expectedGzipLimit) {
|
|
31
|
-
throw new Error(
|
|
32
|
-
`Admin gzip hard limit ${MAX_GZIP_BYTES} does not match the immutable baseline calculation ${expectedGzipLimit}.`,
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const appRoot = await applicationRoot()
|
|
37
|
-
const DIST_DIRECTORY = resolve(appRoot, 'dist')
|
|
38
|
-
const ASSETS_DIRECTORY = resolve(DIST_DIRECTORY, 'assets')
|
|
39
|
-
|
|
40
|
-
async function findJavaScriptChunks(directory, chunks = []) {
|
|
41
|
-
const entries = await readdir(directory, { withFileTypes: true })
|
|
42
|
-
for (const entry of entries) {
|
|
43
|
-
const path = resolve(directory, entry.name)
|
|
44
|
-
if (entry.isDirectory()) await findJavaScriptChunks(path, chunks)
|
|
45
|
-
else if (entry.isFile() && entry.name.endsWith('.js')) chunks.push(path)
|
|
46
|
-
}
|
|
47
|
-
return chunks
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function findSourceMaps(directory, maps = []) {
|
|
51
|
-
const entries = await readdir(directory, { withFileTypes: true })
|
|
52
|
-
for (const entry of entries) {
|
|
53
|
-
const path = resolve(directory, entry.name)
|
|
54
|
-
if (entry.isDirectory()) await findSourceMaps(path, maps)
|
|
55
|
-
else if (entry.isFile() && entry.name.endsWith('.map')) maps.push(path)
|
|
56
|
-
}
|
|
57
|
-
return maps
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function applicationRoot() {
|
|
61
|
-
const workspaceAdmin = resolve(ROOT, 'apps', 'admin')
|
|
62
|
-
try {
|
|
63
|
-
await access(workspaceAdmin)
|
|
64
|
-
return workspaceAdmin
|
|
65
|
-
} catch {
|
|
66
|
-
// The same checker is copied into an exported standalone Admin app.
|
|
67
|
-
return ROOT
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function containsExecutableDebugCode(source) {
|
|
72
|
-
return /\bdebugger\s*;|\bconsole\s*\.\s*(?:assert|clear|count|debug|dir|error|group|info|log|profile|table|time|trace|warn)\s*\(/.test(
|
|
73
|
-
source,
|
|
74
|
-
)
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function containsJavaScriptPayload(source) {
|
|
78
|
-
const withoutComments = source
|
|
79
|
-
.replaceAll(/\/\*[\s\S]*?\*\//g, '')
|
|
80
|
-
.replaceAll(/(^|\n)\s*\/\/[^\n]*/g, '$1')
|
|
81
|
-
.trim()
|
|
82
|
-
return withoutComments !== '' && !/^export\s*\{\s*\}\s*;?$/.test(withoutComments)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function formatKib(bytes) {
|
|
86
|
-
return `${(bytes / 1024).toFixed(1)} KiB`
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function assetPathFromUrl(url) {
|
|
90
|
-
const cleanUrl = url.split(/[?#]/, 1)[0].replaceAll('\\', '/')
|
|
91
|
-
const marker = 'assets/'
|
|
92
|
-
const markerIndex = cleanUrl.indexOf(marker)
|
|
93
|
-
if (markerIndex < 0 || !cleanUrl.endsWith('.js')) return undefined
|
|
94
|
-
const relativePath = cleanUrl.slice(markerIndex + marker.length)
|
|
95
|
-
if (!relativePath || relativePath.includes('../')) return undefined
|
|
96
|
-
return resolve(ASSETS_DIRECTORY, relativePath)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async function readInitialJavaScript() {
|
|
100
|
-
const html = await readFile(resolve(DIST_DIRECTORY, 'index.html'), 'utf8')
|
|
101
|
-
const initial = new Set()
|
|
102
|
-
const entries = new Set()
|
|
103
|
-
|
|
104
|
-
for (const match of html.matchAll(
|
|
105
|
-
/<(script|link)\s[^>]*(?:src|href)=["']([^"']+\.js(?:[?#][^"']*)?)["'][^>]*>/gi,
|
|
106
|
-
)) {
|
|
107
|
-
const path = assetPathFromUrl(match[2])
|
|
108
|
-
if (!path) continue
|
|
109
|
-
initial.add(path)
|
|
110
|
-
if (match[1].toLowerCase() === 'script') entries.add(path)
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (entries.size === 0) throw new Error('Admin index.html does not reference a JavaScript entry.')
|
|
114
|
-
|
|
115
|
-
const sizes = await Promise.all(
|
|
116
|
-
[...initial].map(async (path) => ({ path, size: (await stat(path)).size })),
|
|
117
|
-
)
|
|
118
|
-
const entrySizes = sizes.filter(({ path }) => entries.has(path))
|
|
119
|
-
return {
|
|
120
|
-
entryBytes: entrySizes.reduce((total, { size }) => total + size, 0),
|
|
121
|
-
initialBytes: sizes.reduce((total, { size }) => total + size, 0),
|
|
122
|
-
initialFiles: sizes.length,
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async function main() {
|
|
127
|
-
const chunks = await findJavaScriptChunks(ASSETS_DIRECTORY)
|
|
128
|
-
if (chunks.length === 0) throw new Error('No JavaScript chunks were produced by the Admin build.')
|
|
129
|
-
|
|
130
|
-
const sourceMaps = await findSourceMaps(DIST_DIRECTORY)
|
|
131
|
-
if (DEBUG_BUILD) {
|
|
132
|
-
if (sourceMaps.length === 0) throw new Error('Debug build did not produce source maps.')
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (sourceMaps.length > 0) {
|
|
137
|
-
throw new Error('Production build produced source maps.')
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const artifacts = []
|
|
141
|
-
const empty = []
|
|
142
|
-
const debugCode = []
|
|
143
|
-
for (const chunk of chunks) {
|
|
144
|
-
const path = relative(ROOT, chunk)
|
|
145
|
-
const size = (await stat(chunk)).size
|
|
146
|
-
const source = await readFile(chunk, 'utf8')
|
|
147
|
-
artifacts.push({ path, size })
|
|
148
|
-
if (!containsJavaScriptPayload(source)) empty.push(path)
|
|
149
|
-
if (containsExecutableDebugCode(source)) debugCode.push(path)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
artifacts.sort((left, right) => right.size - left.size || left.path.localeCompare(right.path))
|
|
153
|
-
const oversized = artifacts.filter(({ size }) => size > MAX_CHUNK_BYTES)
|
|
154
|
-
const totalBytes = artifacts.reduce((total, { size }) => total + size, 0)
|
|
155
|
-
const totalGzipBytes = (
|
|
156
|
-
await Promise.all(chunks.map(async (chunk) => gzipSync(await readFile(chunk)).length))
|
|
157
|
-
).reduce((total, size) => total + size, 0)
|
|
158
|
-
const gzipHeadroomBytes = MAX_GZIP_BYTES - totalGzipBytes
|
|
159
|
-
const largest = artifacts[0]
|
|
160
|
-
const initial = await readInitialJavaScript()
|
|
161
|
-
|
|
162
|
-
console.log(
|
|
163
|
-
`[admin-bundle] ${artifacts.length} JavaScript chunks, ${formatKib(totalBytes)} total; ` +
|
|
164
|
-
`largest ${largest.path} (${formatKib(largest.size)}, ${Math.round((largest.size / MAX_CHUNK_BYTES) * 100)}% of budget); ` +
|
|
165
|
-
`entry ${formatKib(initial.entryBytes)}, initial ${initial.initialFiles} files / ${formatKib(initial.initialBytes)}; ` +
|
|
166
|
-
`gzip ${formatKib(totalGzipBytes)} / ${formatKib(MAX_GZIP_BYTES)} hard limit; ` +
|
|
167
|
-
`${formatKib(gzipHeadroomBytes)} headroom`,
|
|
168
|
-
)
|
|
169
|
-
|
|
170
|
-
if (oversized.length > 0) {
|
|
171
|
-
for (const { path, size } of oversized.sort((left, right) => right.size - left.size)) {
|
|
172
|
-
console.error(
|
|
173
|
-
`[admin-bundle] ${path}: ${formatKib(size)} exceeds the ${formatKib(MAX_CHUNK_BYTES)} budget`,
|
|
174
|
-
)
|
|
175
|
-
}
|
|
176
|
-
process.exitCode = 1
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (empty.length > 0) {
|
|
180
|
-
for (const path of empty.sort())
|
|
181
|
-
console.error(`[admin-bundle] ${path}: empty JavaScript chunk is not allowed`)
|
|
182
|
-
process.exitCode = 1
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const budgetFailures = [
|
|
186
|
-
artifacts.length > MAX_CHUNK_COUNT &&
|
|
187
|
-
`${artifacts.length} chunks exceeds the ${MAX_CHUNK_COUNT}-chunk budget`,
|
|
188
|
-
totalBytes > MAX_TOTAL_BYTES &&
|
|
189
|
-
`${formatKib(totalBytes)} total exceeds the ${formatKib(MAX_TOTAL_BYTES)} budget`,
|
|
190
|
-
initial.entryBytes > MAX_ENTRY_BYTES &&
|
|
191
|
-
`${formatKib(initial.entryBytes)} entry exceeds the ${formatKib(MAX_ENTRY_BYTES)} budget`,
|
|
192
|
-
initial.initialFiles > MAX_INITIAL_JS_FILES &&
|
|
193
|
-
`${initial.initialFiles} initial files exceeds the ${MAX_INITIAL_JS_FILES}-file budget`,
|
|
194
|
-
initial.initialBytes > MAX_INITIAL_JS_BYTES &&
|
|
195
|
-
`${formatKib(initial.initialBytes)} initial JavaScript exceeds the ${formatKib(MAX_INITIAL_JS_BYTES)} budget`,
|
|
196
|
-
totalGzipBytes > MAX_GZIP_BYTES &&
|
|
197
|
-
`${formatKib(totalGzipBytes)} JavaScript gzip exceeds the ${formatKib(MAX_GZIP_BYTES)} hard limit (5% historical growth less 10 KiB safety margin)`,
|
|
198
|
-
].filter(Boolean)
|
|
199
|
-
for (const failure of budgetFailures) {
|
|
200
|
-
console.error(`[admin-bundle] ${failure}`)
|
|
201
|
-
process.exitCode = 1
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (debugCode.length > 0) {
|
|
205
|
-
for (const path of debugCode)
|
|
206
|
-
console.error(`[admin-bundle] ${path}: executable console/debugger code is not allowed`)
|
|
207
|
-
process.exitCode = 1
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
main().catch((error) => {
|
|
212
|
-
console.error(`[admin-bundle] ${error.message}`)
|
|
213
|
-
process.exitCode = 1
|
|
214
|
-
})
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schemaVersion": 1,
|
|
3
|
-
"recordedAt": "2026-08-15T09:31:18.000Z",
|
|
4
|
-
"source": {
|
|
5
|
-
"commit": "ac962ddbcbd91470376194b95d2e6323db290277",
|
|
6
|
-
"description": "Production artifacts built before ae4ff1e unified public component entry points. Package values are the gzip sum of every published dist runtime artifact and declared root CSS asset. Baselines are immutable release evidence, not generated by the checker.",
|
|
7
|
-
"adminDistSha256": "4651bb36dcfa1d6bf93667409765fd85e4a2ee7e61592aee14ae0346e99445e6",
|
|
8
|
-
"docsDistSha256": "3a250df67f9ff3b46218972f9e2dff5d31a234bca4f4379add487b14d1fa8740"
|
|
9
|
-
},
|
|
10
|
-
"admin": {
|
|
11
|
-
"javaScriptGzipBytes": 488467
|
|
12
|
-
},
|
|
13
|
-
"docs": {
|
|
14
|
-
"javaScriptGzipBytes": 1023857
|
|
15
|
-
},
|
|
16
|
-
"packages": {
|
|
17
|
-
"http": 7081,
|
|
18
|
-
"icons": 78087,
|
|
19
|
-
"dialog": 17024,
|
|
20
|
-
"editor": 26511,
|
|
21
|
-
"form": 44729,
|
|
22
|
-
"form-table": 8348,
|
|
23
|
-
"search": 16676,
|
|
24
|
-
"table": 79906,
|
|
25
|
-
"table-search": 4713,
|
|
26
|
-
"tabs": 48200,
|
|
27
|
-
"origen-ui": 2206,
|
|
28
|
-
"upload": 17729,
|
|
29
|
-
"router": 15749,
|
|
30
|
-
"shared": 2901
|
|
31
|
-
},
|
|
32
|
-
"introducedAfterBaseline": {
|
|
33
|
-
"permission": "Added by ae4ff1e after the pre-entry-unification baseline; its first released artifact establishes the next baseline."
|
|
34
|
-
},
|
|
35
|
-
"nonBrowserRuntimePackages": {
|
|
36
|
-
"admin-cli": "The CLI publishes templates and Node scripts rather than browser runtime artifacts. Its generated Admin application is covered by the Admin bundle gates."
|
|
37
|
-
}
|
|
38
|
-
}
|