@jmruthers/pace-core 0.5.184 → 0.5.186
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/CHANGELOG.md +38 -0
- package/README.md +60 -1
- package/core-usage-manifest.json +312 -0
- package/dist/{DataTable-QAB34V6K.js → DataTable-IX2NBUTP.js} +6 -6
- package/dist/{DataTable-Bz8ffqyA.d.ts → DataTable-Z9NLVJh0.d.ts} +1 -1
- package/dist/{index-Bl--n7-T.d.ts → PublicPageProvider-DIzEzwKl.d.ts} +23 -10
- package/dist/{UnifiedAuthProvider-7F6T4B6K.js → UnifiedAuthProvider-A4BCQRJY.js} +4 -2
- package/dist/{UnifiedAuthProvider-F86d7dSi.d.ts → UnifiedAuthProvider-BG0AL5eE.d.ts} +2 -1
- package/dist/{api-ROMBCNKU.js → api-BMFCXVQX.js} +2 -2
- package/dist/{chunk-RA3JUFMW.js → chunk-445GEP27.js} +154 -4
- package/dist/{chunk-RA3JUFMW.js.map → chunk-445GEP27.js.map} +1 -1
- package/dist/{chunk-W22JP75J.js → chunk-DAGICKHT.js} +9 -7
- package/dist/chunk-DAGICKHT.js.map +1 -0
- package/dist/{chunk-FUEYYMX5.js → chunk-FXFJRTKI.js} +24 -3
- package/dist/chunk-FXFJRTKI.js.map +1 -0
- package/dist/{chunk-CSOFYHAG.js → chunk-GRIQLQ52.js} +374 -60
- package/dist/chunk-GRIQLQ52.js.map +1 -0
- package/dist/{chunk-NQPMQGS2.js → chunk-HDCUMOOI.js} +497 -399
- package/dist/chunk-HDCUMOOI.js.map +1 -0
- package/dist/chunk-HESYZWZW.js +388 -0
- package/dist/chunk-HESYZWZW.js.map +1 -0
- package/dist/{chunk-QUVSNGIP.js → chunk-HGPQUCBC.js} +34 -9
- package/dist/{chunk-QUVSNGIP.js.map → chunk-HGPQUCBC.js.map} +1 -1
- package/dist/{chunk-PWAHJW4G.js → chunk-OALXJH4Y.js} +86 -33
- package/dist/chunk-OALXJH4Y.js.map +1 -0
- package/dist/{chunk-MI7HBHN3.js → chunk-TC7D3CR3.js} +89 -9
- package/dist/chunk-TC7D3CR3.js.map +1 -0
- package/dist/chunk-THRPYOFK.js +215 -0
- package/dist/chunk-THRPYOFK.js.map +1 -0
- package/dist/{chunk-M7W4CP3M.js → chunk-U6WNSFX5.js} +2 -1
- package/dist/chunk-U6WNSFX5.js.map +1 -0
- package/dist/{chunk-UHNYIBXL.js → chunk-UQWSHFVX.js} +1 -1
- package/dist/chunk-UQWSHFVX.js.map +1 -0
- package/dist/{chunk-QCDXODCA.js → chunk-XAUHJD3L.js} +2 -2
- package/dist/components.d.ts +182 -6
- package/dist/components.js +157 -11
- package/dist/components.js.map +1 -1
- package/dist/{database.generated-CBmg2950.d.ts → database.generated-DI89OQeI.d.ts} +63 -9
- package/dist/eslint-rules/pace-core-compliance.cjs +406 -0
- package/dist/{file-reference-D06mEEWW.d.ts → file-reference-PRTSLxKx.d.ts} +10 -1
- package/dist/hooks.d.ts +52 -15
- package/dist/hooks.js +12 -22
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/index.js +82 -18
- package/dist/index.js.map +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +3 -1
- package/dist/rbac/index.d.ts +206 -15
- package/dist/rbac/index.js +28 -6
- package/dist/timezone-_pgH8qrY.d.ts +530 -0
- package/dist/{types-_x1f4QBF.d.ts → types-DUyCRSTj.d.ts} +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/{usePublicRouteParams-JJczomYq.d.ts → usePublicRouteParams-D71QLlg4.d.ts} +114 -3
- package/dist/utils.d.ts +110 -152
- package/dist/utils.js +128 -138
- package/dist/utils.js.map +1 -1
- package/docs/api/README.md +60 -1
- package/docs/api/classes/ColumnFactory.md +1 -1
- package/docs/api/classes/ErrorBoundary.md +1 -1
- package/docs/api/classes/InvalidScopeError.md +1 -1
- package/docs/api/classes/Logger.md +178 -0
- package/docs/api/classes/MissingUserContextError.md +1 -1
- package/docs/api/classes/OrganisationContextRequiredError.md +1 -1
- package/docs/api/classes/PermissionDeniedError.md +1 -1
- package/docs/api/classes/RBACAuditManager.md +2 -2
- package/docs/api/classes/RBACCache.md +1 -1
- package/docs/api/classes/RBACEngine.md +2 -2
- package/docs/api/classes/RBACError.md +1 -1
- package/docs/api/classes/RBACNotInitializedError.md +1 -1
- package/docs/api/classes/SecureSupabaseClient.md +5 -5
- package/docs/api/classes/StorageUtils.md +1 -1
- package/docs/api/enums/FileCategory.md +1 -1
- package/docs/api/enums/LogLevel.md +54 -0
- package/docs/api/enums/RBACErrorCode.md +1 -1
- package/docs/api/enums/RPCFunction.md +1 -1
- package/docs/api/interfaces/AggregateConfig.md +1 -1
- package/docs/api/interfaces/BadgeProps.md +1 -1
- package/docs/api/interfaces/ButtonProps.md +1 -1
- package/docs/api/interfaces/CalendarProps.md +18 -2
- package/docs/api/interfaces/CardProps.md +1 -1
- package/docs/api/interfaces/ColorPalette.md +1 -1
- package/docs/api/interfaces/ColorShade.md +1 -1
- package/docs/api/interfaces/ComplianceResult.md +30 -0
- package/docs/api/interfaces/DataAccessRecord.md +1 -1
- package/docs/api/interfaces/DataRecord.md +1 -1
- package/docs/api/interfaces/DataTableAction.md +1 -1
- package/docs/api/interfaces/DataTableColumn.md +1 -1
- package/docs/api/interfaces/DataTableProps.md +1 -1
- package/docs/api/interfaces/DataTableToolbarButton.md +1 -1
- package/docs/api/interfaces/DatabaseComplianceResult.md +85 -0
- package/docs/api/interfaces/DatabaseIssue.md +41 -0
- package/docs/api/interfaces/EmptyStateConfig.md +1 -1
- package/docs/api/interfaces/EnhancedNavigationMenuProps.md +1 -1
- package/docs/api/interfaces/EventAppRoleData.md +6 -6
- package/docs/api/interfaces/ExportColumn.md +1 -1
- package/docs/api/interfaces/ExportOptions.md +1 -1
- package/docs/api/interfaces/FileDisplayProps.md +1 -1
- package/docs/api/interfaces/FileMetadata.md +1 -1
- package/docs/api/interfaces/FileReference.md +1 -1
- package/docs/api/interfaces/FileSizeLimits.md +1 -1
- package/docs/api/interfaces/FileUploadOptions.md +48 -8
- package/docs/api/interfaces/FileUploadProps.md +46 -13
- package/docs/api/interfaces/FooterProps.md +1 -1
- package/docs/api/interfaces/FormFieldProps.md +1 -1
- package/docs/api/interfaces/FormProps.md +1 -1
- package/docs/api/interfaces/GrantEventAppRoleParams.md +9 -9
- package/docs/api/interfaces/InactivityWarningModalProps.md +1 -1
- package/docs/api/interfaces/InputProps.md +1 -1
- package/docs/api/interfaces/LabelProps.md +1 -1
- package/docs/api/interfaces/LoggerConfig.md +62 -0
- package/docs/api/interfaces/LoginFormProps.md +1 -1
- package/docs/api/interfaces/NavigationAccessRecord.md +1 -1
- package/docs/api/interfaces/NavigationContextType.md +1 -1
- package/docs/api/interfaces/NavigationGuardProps.md +1 -1
- package/docs/api/interfaces/NavigationItem.md +1 -1
- package/docs/api/interfaces/NavigationMenuProps.md +1 -1
- package/docs/api/interfaces/NavigationProviderProps.md +1 -1
- package/docs/api/interfaces/Organisation.md +1 -1
- package/docs/api/interfaces/OrganisationContextType.md +1 -1
- package/docs/api/interfaces/OrganisationMembership.md +1 -1
- package/docs/api/interfaces/OrganisationProviderProps.md +1 -1
- package/docs/api/interfaces/OrganisationSecurityError.md +1 -1
- package/docs/api/interfaces/PaceAppLayoutProps.md +36 -23
- package/docs/api/interfaces/PaceLoginPageProps.md +1 -1
- package/docs/api/interfaces/PageAccessRecord.md +1 -1
- package/docs/api/interfaces/PagePermissionContextType.md +1 -1
- package/docs/api/interfaces/PagePermissionGuardProps.md +11 -11
- package/docs/api/interfaces/PagePermissionProviderProps.md +1 -1
- package/docs/api/interfaces/PaletteData.md +1 -1
- package/docs/api/interfaces/PermissionEnforcerProps.md +1 -1
- package/docs/api/interfaces/ProgressProps.md +1 -1
- package/docs/api/interfaces/ProtectedRouteProps.md +6 -6
- package/docs/api/interfaces/PublicPageFooterProps.md +1 -1
- package/docs/api/interfaces/PublicPageHeaderProps.md +1 -1
- package/docs/api/interfaces/PublicPageLayoutProps.md +1 -1
- package/docs/api/interfaces/QuickFix.md +52 -0
- package/docs/api/interfaces/RBACAccessValidateParams.md +1 -1
- package/docs/api/interfaces/RBACAccessValidateResult.md +1 -1
- package/docs/api/interfaces/RBACAuditLogParams.md +1 -1
- package/docs/api/interfaces/RBACAuditLogResult.md +1 -1
- package/docs/api/interfaces/RBACConfig.md +4 -4
- package/docs/api/interfaces/RBACContext.md +1 -1
- package/docs/api/interfaces/RBACLogger.md +1 -1
- package/docs/api/interfaces/RBACPageAccessCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionCheckResult.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetParams.md +1 -1
- package/docs/api/interfaces/RBACPermissionsGetResult.md +1 -1
- package/docs/api/interfaces/RBACResult.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantParams.md +1 -1
- package/docs/api/interfaces/RBACRoleGrantResult.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeParams.md +1 -1
- package/docs/api/interfaces/RBACRoleRevokeResult.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateParams.md +1 -1
- package/docs/api/interfaces/RBACRoleValidateResult.md +1 -1
- package/docs/api/interfaces/RBACRolesListParams.md +1 -1
- package/docs/api/interfaces/RBACRolesListResult.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackParams.md +1 -1
- package/docs/api/interfaces/RBACSessionTrackResult.md +1 -1
- package/docs/api/interfaces/ResourcePermissions.md +1 -1
- package/docs/api/interfaces/RevokeEventAppRoleParams.md +7 -7
- package/docs/api/interfaces/RoleBasedRouterContextType.md +1 -1
- package/docs/api/interfaces/RoleBasedRouterProps.md +1 -1
- package/docs/api/interfaces/RoleManagementResult.md +5 -5
- package/docs/api/interfaces/RouteAccessRecord.md +1 -1
- package/docs/api/interfaces/RouteConfig.md +1 -1
- package/docs/api/interfaces/RuntimeComplianceResult.md +55 -0
- package/docs/api/interfaces/SecureDataContextType.md +1 -1
- package/docs/api/interfaces/SecureDataProviderProps.md +1 -1
- package/docs/api/interfaces/SessionRestorationLoaderProps.md +1 -1
- package/docs/api/interfaces/SetupIssue.md +41 -0
- package/docs/api/interfaces/StorageConfig.md +1 -1
- package/docs/api/interfaces/StorageFileInfo.md +1 -1
- package/docs/api/interfaces/StorageFileMetadata.md +1 -1
- package/docs/api/interfaces/StorageListOptions.md +1 -1
- package/docs/api/interfaces/StorageListResult.md +1 -1
- package/docs/api/interfaces/StorageUploadOptions.md +1 -1
- package/docs/api/interfaces/StorageUploadResult.md +1 -1
- package/docs/api/interfaces/StorageUrlOptions.md +1 -1
- package/docs/api/interfaces/StyleImport.md +1 -1
- package/docs/api/interfaces/SwitchProps.md +1 -1
- package/docs/api/interfaces/TabsContentProps.md +1 -1
- package/docs/api/interfaces/TabsListProps.md +1 -1
- package/docs/api/interfaces/TabsProps.md +1 -1
- package/docs/api/interfaces/TabsTriggerProps.md +1 -1
- package/docs/api/interfaces/TextareaProps.md +1 -1
- package/docs/api/interfaces/ToastActionElement.md +1 -1
- package/docs/api/interfaces/ToastProps.md +1 -1
- package/docs/api/interfaces/UnifiedAuthContextType.md +1 -1
- package/docs/api/interfaces/UnifiedAuthProviderProps.md +1 -1
- package/docs/api/interfaces/UseFormDialogOptions.md +62 -0
- package/docs/api/interfaces/UseFormDialogReturn.md +117 -0
- package/docs/api/interfaces/UseInactivityTrackerOptions.md +1 -1
- package/docs/api/interfaces/UseInactivityTrackerReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventLogoOptions.md +2 -2
- package/docs/api/interfaces/UsePublicEventLogoReturn.md +1 -1
- package/docs/api/interfaces/UsePublicEventOptions.md +1 -1
- package/docs/api/interfaces/UsePublicEventReturn.md +1 -1
- package/docs/api/interfaces/UsePublicFileDisplayOptions.md +2 -2
- package/docs/api/interfaces/UsePublicFileDisplayReturn.md +1 -1
- package/docs/api/interfaces/UsePublicRouteParamsReturn.md +1 -1
- package/docs/api/interfaces/UseResolvedScopeOptions.md +2 -2
- package/docs/api/interfaces/UseResolvedScopeReturn.md +1 -1
- package/docs/api/interfaces/UseResourcePermissionsOptions.md +1 -1
- package/docs/api/interfaces/UserEventAccess.md +1 -1
- package/docs/api/interfaces/UserMenuProps.md +1 -1
- package/docs/api/interfaces/UserProfile.md +1 -1
- package/docs/api/modules.md +746 -50
- package/docs/api-reference/components.md +26 -12
- package/docs/api-reference/hooks.md +111 -0
- package/docs/api-reference/rpc-functions.md +1 -1
- package/docs/api-reference/utilities.md +184 -0
- package/docs/getting-started/installation-guide.md +75 -16
- package/docs/getting-started/quick-start.md +61 -11
- package/docs/implementation-guides/authentication.md +88 -12
- package/docs/implementation-guides/file-reference-system.md +26 -3
- package/docs/implementation-guides/file-upload-storage.md +30 -1
- package/docs/rbac/README.md +1 -0
- package/docs/rbac/compliance/compliance-guide.md +544 -0
- package/docs/rbac/getting-started.md +158 -33
- package/docs/standards/pace-core-compliance.md +432 -0
- package/eslint-config-pace-core.cjs +93 -0
- package/package.json +15 -3
- package/scripts/analyze-bundle.js +232 -0
- package/scripts/build-css.js +56 -0
- package/scripts/build-docs-incremental.js +1015 -0
- package/scripts/check-pace-core-compliance.cjs +2353 -0
- package/scripts/check-pace-core-compliance.js +512 -0
- package/scripts/generate-docs.js +157 -0
- package/scripts/setup-build-cache.js +73 -0
- package/scripts/utils/command-runner.js +131 -0
- package/scripts/utils/env.js +33 -0
- package/scripts/utils/index.js +10 -0
- package/scripts/utils/logger.js +88 -0
- package/scripts/utils/path-helpers.js +37 -0
- package/scripts/validate-formats.js +133 -0
- package/scripts/validate-master.js +155 -0
- package/scripts/validate-pre-publish.js +140 -0
- package/scripts/validate-theme.js +142 -0
- package/src/components/Calendar/Calendar.tsx +8 -1
- package/src/components/Card/Card.tsx +47 -8
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.test.tsx +314 -0
- package/src/components/DatePickerWithTimezone/DatePickerWithTimezone.tsx +126 -0
- package/src/components/DatePickerWithTimezone/README.md +135 -0
- package/src/components/DatePickerWithTimezone/index.ts +10 -0
- package/src/components/DateTimeField/DateTimeField.test.tsx +358 -0
- package/src/components/DateTimeField/DateTimeField.tsx +232 -0
- package/src/components/DateTimeField/README.md +148 -0
- package/src/components/DateTimeField/index.ts +10 -0
- package/src/components/FileUpload/FileUpload.test.tsx +2 -0
- package/src/components/FileUpload/FileUpload.tsx +10 -1
- package/src/components/Header/Header.test.tsx +47 -18
- package/src/components/Header/Header.tsx +22 -7
- package/src/components/PaceAppLayout/PaceAppLayout.tsx +29 -20
- package/src/components/PaceAppLayout/README.md +9 -0
- package/src/components/ProtectedRoute/ProtectedRoute.test.tsx +37 -8
- package/src/components/ProtectedRoute/ProtectedRoute.tsx +146 -5
- package/src/components/index.ts +8 -0
- package/src/eslint-rules/pace-core-compliance.cjs +406 -0
- package/src/eslint-rules/pace-core-compliance.js +640 -0
- package/src/hooks/__tests__/useFormDialog.test.ts +478 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useFileReference.test.ts +2 -0
- package/src/hooks/useFormDialog.ts +147 -0
- package/src/hooks/usePreventTabReload.ts +106 -0
- package/src/hooks/useSecureDataAccess.ts +2 -2
- package/src/index.ts +27 -0
- package/src/providers/services/OrganisationServiceProvider.tsx +6 -5
- package/src/providers/services/UnifiedAuthProvider.tsx +24 -3
- package/src/rbac/__tests__/rbac-role-isolation.test.ts +456 -0
- package/src/rbac/__tests__/scenarios.user-role.test.tsx +3 -0
- package/src/rbac/compliance/database-validator.ts +165 -0
- package/src/rbac/compliance/index.ts +38 -0
- package/src/rbac/compliance/quick-fix-suggestions.ts +209 -0
- package/src/rbac/compliance/runtime-compliance.ts +77 -0
- package/src/rbac/compliance/setup-validator.ts +131 -0
- package/src/rbac/components/PagePermissionGuard.tsx +8 -64
- package/src/rbac/components/__tests__/PagePermissionGuard.test.tsx +35 -21
- package/src/rbac/docs/event-based-apps.md +285 -0
- package/src/rbac/errors.ts +11 -0
- package/src/rbac/hooks/useRoleManagement.ts +292 -12
- package/src/rbac/index.ts +30 -0
- package/src/services/OrganisationService.ts +4 -0
- package/src/styles/core.css +5 -5
- package/src/types/database.generated.ts +63 -9
- package/src/types/file-reference.ts +9 -0
- package/src/utils/__tests__/timezone.test.ts +345 -0
- package/src/utils/file-reference/__tests__/file-reference.test.ts +60 -4
- package/src/utils/file-reference/index.ts +13 -2
- package/src/utils/formatting/formatDateTimeTimezone.test.ts +167 -0
- package/src/utils/formatting/formatting.ts +179 -0
- package/src/utils/index.ts +27 -1
- package/src/utils/location/index.ts +16 -0
- package/src/utils/location/location.test.ts +286 -0
- package/src/utils/location/location.ts +175 -0
- package/src/utils/security/secureDataAccess.ts +1 -1
- package/src/utils/storage/helpers.ts +68 -0
- package/src/utils/timezone/index.ts +17 -0
- package/src/utils/timezone/timezone.test.ts +349 -0
- package/src/utils/timezone/timezone.ts +281 -0
- package/dist/chunk-CSOFYHAG.js.map +0 -1
- package/dist/chunk-FUEYYMX5.js.map +0 -1
- package/dist/chunk-HKIT6O7W.js +0 -198
- package/dist/chunk-HKIT6O7W.js.map +0 -1
- package/dist/chunk-KUEN3HFB.js +0 -94
- package/dist/chunk-KUEN3HFB.js.map +0 -1
- package/dist/chunk-M7W4CP3M.js.map +0 -1
- package/dist/chunk-MI7HBHN3.js.map +0 -1
- package/dist/chunk-NQPMQGS2.js.map +0 -1
- package/dist/chunk-PWAHJW4G.js.map +0 -1
- package/dist/chunk-UHNYIBXL.js.map +0 -1
- package/dist/chunk-W22JP75J.js.map +0 -1
- package/dist/formatting-5wETwiGF.d.ts +0 -162
- /package/dist/{DataTable-QAB34V6K.js.map → DataTable-IX2NBUTP.js.map} +0 -0
- /package/dist/{UnifiedAuthProvider-7F6T4B6K.js.map → UnifiedAuthProvider-A4BCQRJY.js.map} +0 -0
- /package/dist/{api-ROMBCNKU.js.map → api-BMFCXVQX.js.map} +0 -0
- /package/dist/{chunk-QCDXODCA.js.map → chunk-XAUHJD3L.js.map} +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint Config Preset for pace-core Compliance
|
|
3
|
+
* @package @jmruthers/pace-core
|
|
4
|
+
* @module ESLintConfig
|
|
5
|
+
*
|
|
6
|
+
* Shareable ESLint configuration that consuming apps can extend
|
|
7
|
+
* to enforce pace-core usage patterns.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // In your consuming app's eslint.config.js:
|
|
11
|
+
* import paceCoreConfig from '@jmruthers/pace-core/eslint-config';
|
|
12
|
+
*
|
|
13
|
+
* export default [
|
|
14
|
+
* ...paceCoreConfig,
|
|
15
|
+
* // your other config
|
|
16
|
+
* ];
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const path = require('path');
|
|
20
|
+
const fs = require('fs');
|
|
21
|
+
|
|
22
|
+
// Load manifest to get restricted imports
|
|
23
|
+
let restrictedImports = [];
|
|
24
|
+
try {
|
|
25
|
+
const manifestPath = path.join(__dirname, 'core-usage-manifest.json');
|
|
26
|
+
if (fs.existsSync(manifestPath)) {
|
|
27
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
|
|
28
|
+
restrictedImports = manifest.restrictedImports || [];
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.warn('Warning: Could not load core-usage-manifest.json for ESLint config');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Load pace-core compliance rules
|
|
35
|
+
let paceCoreRules = {};
|
|
36
|
+
try {
|
|
37
|
+
// Try source path first (for development)
|
|
38
|
+
const sourceRulesPath = path.resolve(__dirname, 'src/eslint-rules/pace-core-compliance.cjs');
|
|
39
|
+
if (fs.existsSync(sourceRulesPath)) {
|
|
40
|
+
paceCoreRules = require(sourceRulesPath).rules;
|
|
41
|
+
} else {
|
|
42
|
+
// Try dist path (for published package)
|
|
43
|
+
const distRulesPath = path.resolve(__dirname, 'dist/eslint-rules/pace-core-compliance.cjs');
|
|
44
|
+
if (fs.existsSync(distRulesPath)) {
|
|
45
|
+
paceCoreRules = require(distRulesPath).rules;
|
|
46
|
+
} else {
|
|
47
|
+
// Try relative to current working directory (for consuming apps)
|
|
48
|
+
const cwdRulesPath = path.resolve(process.cwd(), 'node_modules/@jmruthers/pace-core/dist/eslint-rules/pace-core-compliance.cjs');
|
|
49
|
+
if (fs.existsSync(cwdRulesPath)) {
|
|
50
|
+
paceCoreRules = require(cwdRulesPath).rules;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
} catch (error) {
|
|
55
|
+
// Silently fail - rules will be empty, but config will still work
|
|
56
|
+
// This allows the config to be used even if rules aren't available
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Build restricted imports for no-restricted-imports rule (ESLint 9 flat config format)
|
|
60
|
+
// ESLint 9 expects an array of objects with 'name' (string or regex) and 'message'
|
|
61
|
+
const restrictedImportRules = restrictedImports.map(({ module, reason }) => ({
|
|
62
|
+
name: module,
|
|
63
|
+
message: reason || `Use pace-core alternative instead of direct import of '${module}'`
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
// Also add pattern for @radix-ui/* (catch-all) - use string pattern format
|
|
67
|
+
restrictedImportRules.push({
|
|
68
|
+
name: '@radix-ui/*',
|
|
69
|
+
message: 'Use pace-core components instead of direct Radix UI imports'
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
module.exports = [
|
|
73
|
+
{
|
|
74
|
+
plugins: {
|
|
75
|
+
'pace-core-compliance': {
|
|
76
|
+
rules: paceCoreRules
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
rules: {
|
|
80
|
+
// Use pace-core compliance rules
|
|
81
|
+
'pace-core-compliance/no-restricted-imports': 'error',
|
|
82
|
+
'pace-core-compliance/prefer-pace-core-components': 'warn',
|
|
83
|
+
'pace-core-compliance/prefer-pace-core-hooks': 'warn',
|
|
84
|
+
'pace-core-compliance/prefer-pace-core-utils': 'warn',
|
|
85
|
+
'pace-core-compliance/no-local-component-duplication': 'error',
|
|
86
|
+
|
|
87
|
+
// Also use standard no-restricted-imports (ESLint 9 flat config format)
|
|
88
|
+
// Note: ESLint 9 uses a simpler array format
|
|
89
|
+
'no-restricted-imports': ['error', ...restrictedImportRules]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jmruthers/pace-core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.186",
|
|
4
4
|
"description": "Clean, modern React component library with Tailwind v4 styling and native utilities",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -52,6 +52,12 @@
|
|
|
52
52
|
"import": "./dist/rbac/eslint-rules.js",
|
|
53
53
|
"default": "./dist/rbac/eslint-rules.js"
|
|
54
54
|
},
|
|
55
|
+
"./eslint-rules": {
|
|
56
|
+
"require": "./dist/eslint-rules/pace-core-compliance.cjs",
|
|
57
|
+
"import": "./dist/eslint-rules/pace-core-compliance.cjs",
|
|
58
|
+
"default": "./dist/eslint-rules/pace-core-compliance.cjs"
|
|
59
|
+
},
|
|
60
|
+
"./eslint-config": "./eslint-config-pace-core.cjs",
|
|
55
61
|
"./styles/core.css": "./src/styles/core.css",
|
|
56
62
|
"./theming/runtime": {
|
|
57
63
|
"types": "./dist/theming/runtime.d.ts",
|
|
@@ -64,6 +70,7 @@
|
|
|
64
70
|
},
|
|
65
71
|
"./docs": "./docs/README.md",
|
|
66
72
|
"./package.json": "./package.json",
|
|
73
|
+
"./core-usage-manifest.json": "./core-usage-manifest.json",
|
|
67
74
|
"./source": {
|
|
68
75
|
"import": "./src/index.ts",
|
|
69
76
|
"default": "./src/index.ts"
|
|
@@ -128,7 +135,10 @@
|
|
|
128
135
|
"examples",
|
|
129
136
|
"README.md",
|
|
130
137
|
"CHANGELOG.md",
|
|
131
|
-
"docs"
|
|
138
|
+
"docs",
|
|
139
|
+
"core-usage-manifest.json",
|
|
140
|
+
"eslint-config-pace-core.cjs",
|
|
141
|
+
"scripts"
|
|
132
142
|
],
|
|
133
143
|
"scripts": {
|
|
134
144
|
"_comment_build": "Build package and documentation",
|
|
@@ -235,6 +245,8 @@
|
|
|
235
245
|
},
|
|
236
246
|
"dependencies": {
|
|
237
247
|
"@supabase/supabase-js": "^2.49.10",
|
|
238
|
-
"@tanstack/react-query": "^5.56.2"
|
|
248
|
+
"@tanstack/react-query": "^5.56.2",
|
|
249
|
+
"date-fns": "^3.0.0",
|
|
250
|
+
"date-fns-tz": "^3.0.0"
|
|
239
251
|
}
|
|
240
252
|
}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced Bundle Analysis Script
|
|
4
|
+
* Comprehensive analysis of the built package for size, composition, and optimization opportunities
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { readFileSync, readdirSync, statSync } from 'fs';
|
|
8
|
+
import { join, extname } from 'path';
|
|
9
|
+
|
|
10
|
+
const distDir = 'dist';
|
|
11
|
+
|
|
12
|
+
function getDirectorySize(dirPath) {
|
|
13
|
+
let totalSize = 0;
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const items = readdirSync(dirPath);
|
|
17
|
+
|
|
18
|
+
for (const item of items) {
|
|
19
|
+
const itemPath = join(dirPath, item);
|
|
20
|
+
const stats = statSync(itemPath);
|
|
21
|
+
|
|
22
|
+
if (stats.isDirectory()) {
|
|
23
|
+
totalSize += getDirectorySize(itemPath);
|
|
24
|
+
} else {
|
|
25
|
+
totalSize += stats.size;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
} catch (error) {
|
|
29
|
+
console.warn(`Warning: Could not read directory ${dirPath}`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return totalSize;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function formatBytes(bytes) {
|
|
36
|
+
if (bytes === 0) return '0 Bytes';
|
|
37
|
+
|
|
38
|
+
const k = 1024;
|
|
39
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
40
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
41
|
+
|
|
42
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function analyzeModuleContent(filePath) {
|
|
46
|
+
try {
|
|
47
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
hasESMExports: content.includes('export '),
|
|
51
|
+
hasCJSExports: content.includes('module.exports') || content.includes('exports.'),
|
|
52
|
+
hasClientDirective: content.includes('"use client"'),
|
|
53
|
+
hasSourceMap: content.includes('//# sourceMappingURL='),
|
|
54
|
+
linesOfCode: content.split('\n').length,
|
|
55
|
+
estimatedComplexity: (content.match(/function|class|const|let|var/g) || []).length,
|
|
56
|
+
importCount: (content.match(/import\s+.*from/g) || []).length,
|
|
57
|
+
exportCount: (content.match(/export\s+/g) || []).length
|
|
58
|
+
};
|
|
59
|
+
} catch (error) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function validateFormatCompliance(filePath, expectedFormat) {
|
|
65
|
+
try {
|
|
66
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
67
|
+
|
|
68
|
+
if (expectedFormat === 'esm') {
|
|
69
|
+
return {
|
|
70
|
+
valid: content.includes('export') && !content.includes('module.exports'),
|
|
71
|
+
hasClientDirective: content.includes('"use client"'),
|
|
72
|
+
usesESMSyntax: content.includes('export') || content.includes('import')
|
|
73
|
+
};
|
|
74
|
+
} else if (expectedFormat === 'cjs') {
|
|
75
|
+
return {
|
|
76
|
+
valid: content.includes('exports') || content.includes('module.exports'),
|
|
77
|
+
hasClientDirective: content.includes('"use client"'),
|
|
78
|
+
usesCJSSyntax: content.includes('exports') || content.includes('require')
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return { valid: false };
|
|
83
|
+
} catch (error) {
|
|
84
|
+
return { valid: false, error: error.message };
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function generateSizeComparison(modules) {
|
|
89
|
+
const sizeData = modules.map(module => {
|
|
90
|
+
try {
|
|
91
|
+
const esmSize = statSync(join(distDir, module.esm)).size;
|
|
92
|
+
const cjsSize = statSync(join(distDir, module.cjs)).size;
|
|
93
|
+
const dtsSize = statSync(join(distDir, module.dts)).size;
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
name: module.name,
|
|
97
|
+
esm: esmSize,
|
|
98
|
+
cjs: cjsSize,
|
|
99
|
+
dts: dtsSize,
|
|
100
|
+
total: esmSize + cjsSize + dtsSize,
|
|
101
|
+
ratio: (esmSize / cjsSize).toFixed(2)
|
|
102
|
+
};
|
|
103
|
+
} catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}).filter(Boolean);
|
|
107
|
+
|
|
108
|
+
return sizeData.sort((a, b) => b.total - a.total);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function analyzeBundle() {
|
|
112
|
+
console.log('📊 Enhanced Bundle Analysis Report\n');
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
// Get total package size
|
|
116
|
+
const totalSize = getDirectorySize(distDir);
|
|
117
|
+
console.log(`📦 Total Package Size: ${formatBytes(totalSize)}\n`);
|
|
118
|
+
|
|
119
|
+
// Analyze individual modules with both formats
|
|
120
|
+
const modules = [
|
|
121
|
+
{ name: 'index', esm: 'index.js', cjs: 'index.cjs', dts: 'index.d.ts' },
|
|
122
|
+
{ name: 'auth', esm: 'auth.js', cjs: 'auth.cjs', dts: 'auth.d.ts' },
|
|
123
|
+
{ name: 'components', esm: 'components.js', cjs: 'components.cjs', dts: 'components.d.ts' },
|
|
124
|
+
{ name: 'validation', esm: 'validation.js', cjs: 'validation.cjs', dts: 'validation.d.ts' },
|
|
125
|
+
{ name: 'hooks', esm: 'hooks.js', cjs: 'hooks.cjs', dts: 'hooks.d.ts' },
|
|
126
|
+
{ name: 'types', esm: 'types.js', cjs: 'types.cjs', dts: 'types.d.ts' }
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
console.log('📋 Module Breakdown:');
|
|
130
|
+
console.log('─'.repeat(80));
|
|
131
|
+
console.log('Module'.padEnd(12) + 'ESM'.padEnd(12) + 'CJS'.padEnd(12) + 'Types'.padEnd(12) + 'Total'.padEnd(12) + 'Ratio');
|
|
132
|
+
console.log('─'.repeat(80));
|
|
133
|
+
|
|
134
|
+
const sizeComparison = generateSizeComparison(modules);
|
|
135
|
+
|
|
136
|
+
for (const moduleData of sizeComparison) {
|
|
137
|
+
console.log(
|
|
138
|
+
moduleData.name.padEnd(12) +
|
|
139
|
+
formatBytes(moduleData.esm).padEnd(12) +
|
|
140
|
+
formatBytes(moduleData.cjs).padEnd(12) +
|
|
141
|
+
formatBytes(moduleData.dts).padEnd(12) +
|
|
142
|
+
formatBytes(moduleData.total).padEnd(12) +
|
|
143
|
+
moduleData.ratio
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Format validation
|
|
148
|
+
console.log('\n🔍 Format Validation:');
|
|
149
|
+
|
|
150
|
+
for (const module of modules) {
|
|
151
|
+
const esmValidation = validateFormatCompliance(join(distDir, module.esm), 'esm');
|
|
152
|
+
const cjsValidation = validateFormatCompliance(join(distDir, module.cjs), 'cjs');
|
|
153
|
+
|
|
154
|
+
console.log(` 📄 ${module.name}:`);
|
|
155
|
+
console.log(` ESM: ${esmValidation.valid ? '✅' : '❌'} Valid${esmValidation.hasClientDirective ? ' + Client Directive' : ''}`);
|
|
156
|
+
console.log(` CJS: ${cjsValidation.valid ? '✅' : '❌'} Valid${cjsValidation.hasClientDirective ? ' + Client Directive' : ''}`);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Quality analysis
|
|
160
|
+
console.log('\n🔍 Quality Analysis:');
|
|
161
|
+
|
|
162
|
+
const mainModule = join(distDir, 'index.js');
|
|
163
|
+
const mainAnalysis = analyzeModuleContent(mainModule);
|
|
164
|
+
|
|
165
|
+
if (mainAnalysis) {
|
|
166
|
+
console.log(` 📄 Main module (index.js):`);
|
|
167
|
+
console.log(` ✅ ESM exports: ${mainAnalysis.hasESMExports}`);
|
|
168
|
+
console.log(` ✅ Client directive: ${mainAnalysis.hasClientDirective}`);
|
|
169
|
+
console.log(` ✅ Source maps: ${mainAnalysis.hasSourceMap}`);
|
|
170
|
+
console.log(` 📊 Lines of code: ${mainAnalysis.linesOfCode}`);
|
|
171
|
+
console.log(` 🧮 Estimated complexity: ${mainAnalysis.estimatedComplexity}`);
|
|
172
|
+
console.log(` 📥 Import count: ${mainAnalysis.importCount}`);
|
|
173
|
+
console.log(` 📤 Export count: ${mainAnalysis.exportCount}`);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Performance recommendations
|
|
177
|
+
console.log('\n💡 Optimization Opportunities:');
|
|
178
|
+
|
|
179
|
+
if (totalSize > 500000) { // 500KB
|
|
180
|
+
console.log(' ⚠️ Package size is large (>500KB). Consider:');
|
|
181
|
+
console.log(' - Reviewing large dependencies');
|
|
182
|
+
console.log(' - Splitting into smaller modules');
|
|
183
|
+
console.log(' - Enabling better tree-shaking');
|
|
184
|
+
} else if (totalSize > 300000) { // 300KB
|
|
185
|
+
console.log(' ℹ️ Package size is moderate (>300KB). Monitor growth.');
|
|
186
|
+
} else {
|
|
187
|
+
console.log(' ✅ Package size is optimal (<300KB)');
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Tree-shaking analysis
|
|
191
|
+
const treeShakingScore = sizeComparison.reduce((score, module) => {
|
|
192
|
+
const ratio = parseFloat(module.ratio);
|
|
193
|
+
return score + (ratio > 0.8 && ratio < 1.2 ? 1 : 0);
|
|
194
|
+
}, 0);
|
|
195
|
+
|
|
196
|
+
console.log(` 🌳 Tree-shaking efficiency: ${treeShakingScore}/${sizeComparison.length} modules optimized`);
|
|
197
|
+
|
|
198
|
+
// Module size distribution
|
|
199
|
+
const largestModule = sizeComparison[0];
|
|
200
|
+
if (largestModule) {
|
|
201
|
+
console.log(` 📈 Largest module: ${largestModule.name} (${formatBytes(largestModule.total)})`);
|
|
202
|
+
if (largestModule.total > totalSize * 0.4) {
|
|
203
|
+
console.log(' 💡 Consider splitting this module for better tree-shaking');
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
console.log('\n📋 Build Quality Summary:');
|
|
208
|
+
console.log(` ✅ Total modules: ${modules.length}`);
|
|
209
|
+
console.log(` ✅ Dual format (ESM/CJS): Available`);
|
|
210
|
+
console.log(` ✅ Type definitions: Complete`);
|
|
211
|
+
console.log(` ✅ Client directives: Properly injected`);
|
|
212
|
+
console.log(` ✅ Source maps: Generated`);
|
|
213
|
+
|
|
214
|
+
// Cache recommendations
|
|
215
|
+
console.log('\n🚀 CI/CD Optimization:');
|
|
216
|
+
console.log(' 💡 Build caching recommended for:');
|
|
217
|
+
console.log(' - node_modules (dependency cache)');
|
|
218
|
+
console.log(' - TypeScript compilation output');
|
|
219
|
+
console.log(' - tsup build cache (.tsup directory)');
|
|
220
|
+
|
|
221
|
+
} catch (error) {
|
|
222
|
+
console.error('❌ Bundle analysis failed:', error.message);
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Only run if called directly (not imported)
|
|
228
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
229
|
+
analyzeBundle();
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export { analyzeBundle };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build script for PACE Core CSS files
|
|
5
|
+
* This script validates CSS files and ensures they're ready for consumption
|
|
6
|
+
* Note: CSS files are now exported directly from src/styles, no dist copying needed
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { existsSync, mkdirSync, readdirSync, copyFileSync } from 'fs';
|
|
10
|
+
import { join } from 'path';
|
|
11
|
+
import { getPackageRoot, getRepoRoot } from './utils/path-helpers.js';
|
|
12
|
+
import { logger } from './utils/logger.js';
|
|
13
|
+
|
|
14
|
+
const packageRoot = getPackageRoot(import.meta.url);
|
|
15
|
+
const repoRoot = getRepoRoot(import.meta.url);
|
|
16
|
+
const srcDir = join(packageRoot, 'src/styles');
|
|
17
|
+
|
|
18
|
+
// List of CSS files to validate
|
|
19
|
+
const cssFiles = ['core.css'];
|
|
20
|
+
|
|
21
|
+
logger.info('Validating PACE Core CSS files (exporting directly from src/styles)...');
|
|
22
|
+
|
|
23
|
+
// Validate each CSS file exists
|
|
24
|
+
cssFiles.forEach(file => {
|
|
25
|
+
const srcPath = join(srcDir, file);
|
|
26
|
+
|
|
27
|
+
if (existsSync(srcPath)) {
|
|
28
|
+
logger.success(`Validated ${file} exists in src/styles/`);
|
|
29
|
+
} else {
|
|
30
|
+
logger.error(`CSS file not found: ${srcPath}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Copy fonts to public folder for development (if it exists)
|
|
36
|
+
const fontsSrcDir = join(packageRoot, 'src/fonts');
|
|
37
|
+
const publicFontsDir = join(repoRoot, 'public/fonts');
|
|
38
|
+
if (existsSync(join(repoRoot, 'public'))) {
|
|
39
|
+
if (!existsSync(publicFontsDir)) {
|
|
40
|
+
mkdirSync(publicFontsDir, { recursive: true });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (existsSync(fontsSrcDir)) {
|
|
44
|
+
const fontFiles = readdirSync(fontsSrcDir);
|
|
45
|
+
fontFiles.forEach(file => {
|
|
46
|
+
if (file.endsWith('.woff2')) {
|
|
47
|
+
const srcPath = join(fontsSrcDir, file);
|
|
48
|
+
const publicPath = join(publicFontsDir, file);
|
|
49
|
+
copyFileSync(srcPath, publicPath);
|
|
50
|
+
logger.success(`Copied font ${file} → public/fonts/${file}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
logger.success('CSS validation completed! Core CSS file ready for consumption from src/styles/');
|