kimu-core 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +30 -0
- package/.gitattributes +11 -0
- package/.github/FUNDING.yml +8 -0
- package/.github/copilot-instructions.md +103 -0
- package/.github/kimu-copilot-instructions.md +3779 -0
- package/.github/workflows/deploy-demo.yml +39 -0
- package/AUTHORS.md +20 -0
- package/CHANGELOG.md +20 -0
- package/CODE_GUIDELINES.md +165 -0
- package/CODE_OF_CONDUCT.md +47 -0
- package/CONTRIBUTING.md +62 -0
- package/FUNDING.md +31 -0
- package/ISSUE_GUIDELINES.md +74 -0
- package/LICENSE +17 -0
- package/LICENSE.it.md +17 -0
- package/MPL-2.0.txt +373 -0
- package/NOTICE +65 -0
- package/README-KIMU.md +40 -0
- package/README.it.md +208 -0
- package/README.md +266 -0
- package/SECURITY.md +64 -0
- package/docs/get-started-en.md +207 -0
- package/docs/images/icon.svg +64 -0
- package/docs/images/logo_kimu.png +0 -0
- package/docs/index.md +29 -0
- package/env/dev.config.json +6 -0
- package/env/local.config.json +6 -0
- package/env/prod.config.json +6 -0
- package/env/staging.config.json +6 -0
- package/env/test.config.json +4 -0
- package/icon.svg +10 -0
- package/logo_kimu.png +0 -0
- package/package.json +79 -0
- package/public/favicon.svg +64 -0
- package/public/logo_kimu.svg +1 -0
- package/scripts/build-all-config.js +59 -0
- package/scripts/build-all-core.js +65 -0
- package/scripts/build-all-extensions.js +64 -0
- package/scripts/build-all-modules.js +99 -0
- package/scripts/build-extension.js +60 -0
- package/scripts/clear-kimu-build.js +31 -0
- package/scripts/generate-kimu-build-config.js +79 -0
- package/scripts/install-module.js +162 -0
- package/scripts/list-modules.js +109 -0
- package/scripts/minify-css-assets.js +82 -0
- package/scripts/remove-module.js +122 -0
- package/scripts/utils/fix-imports.js +85 -0
- package/src/assets/index.css +43 -0
- package/src/assets/kimu-style.css +84 -0
- package/src/assets/style.css +116 -0
- package/src/config/kimu-base-config.json +5 -0
- package/src/core/index.ts +47 -0
- package/src/core/kimu-app.ts +76 -0
- package/src/core/kimu-asset-manager.ts +167 -0
- package/src/core/kimu-component-element.ts +325 -0
- package/src/core/kimu-component.ts +33 -0
- package/src/core/kimu-engine.ts +188 -0
- package/src/core/kimu-extension-manager.ts +281 -0
- package/src/core/kimu-global-styles.ts +136 -0
- package/src/core/kimu-module-manager.ts +69 -0
- package/src/core/kimu-module.ts +21 -0
- package/src/core/kimu-path-config.ts +127 -0
- package/src/core/kimu-reactive.ts +196 -0
- package/src/core/kimu-render.ts +91 -0
- package/src/core/kimu-store.ts +147 -0
- package/src/core/kimu-types.ts +65 -0
- package/src/extensions/.gitkeep +0 -0
- package/src/extensions/extensions-manifest.json +13 -0
- package/src/extensions/kimu-home/component.ts +80 -0
- package/src/extensions/kimu-home/lang/en.json +5 -0
- package/src/extensions/kimu-home/lang/it.json +5 -0
- package/src/extensions/kimu-home/style.css +61 -0
- package/src/extensions/kimu-home/view.html +51 -0
- package/src/index.html +26 -0
- package/src/main.ts +68 -0
- package/src/modules/.gitkeep +0 -0
- package/src/modules/README.md +79 -0
- package/src/modules/i18n/README.it.md +63 -0
- package/src/modules/i18n/README.md +63 -0
- package/src/modules/i18n/kimu-global-lang.ts +26 -0
- package/src/modules/i18n/kimu-i18n-service.ts +108 -0
- package/src/modules/i18n/manifest.json +22 -0
- package/src/modules/i18n/module.ts +39 -0
- package/src/modules/modules-manifest.json +12 -0
- package/src/modules-repository/README.md +108 -0
- package/src/modules-repository/api-axios/CHANGELOG.md +48 -0
- package/src/modules-repository/api-axios/QUICK-REFERENCE.md +178 -0
- package/src/modules-repository/api-axios/README.md +304 -0
- package/src/modules-repository/api-axios/api-axios-service.ts +355 -0
- package/src/modules-repository/api-axios/examples.ts +293 -0
- package/src/modules-repository/api-axios/index.ts +19 -0
- package/src/modules-repository/api-axios/interfaces.ts +71 -0
- package/src/modules-repository/api-axios/module.ts +41 -0
- package/src/modules-repository/api-core/CHANGELOG.md +42 -0
- package/src/modules-repository/api-core/QUICK-REFERENCE.md +192 -0
- package/src/modules-repository/api-core/README.md +435 -0
- package/src/modules-repository/api-core/api-core-service.ts +289 -0
- package/src/modules-repository/api-core/examples.ts +432 -0
- package/src/modules-repository/api-core/index.ts +8 -0
- package/src/modules-repository/api-core/interfaces.ts +83 -0
- package/src/modules-repository/api-core/module.ts +30 -0
- package/src/modules-repository/event-bus/README.md +273 -0
- package/src/modules-repository/event-bus/event-bus-service.ts +176 -0
- package/src/modules-repository/event-bus/module.ts +30 -0
- package/src/modules-repository/i18n/README.it.md +63 -0
- package/src/modules-repository/i18n/README.md +63 -0
- package/src/modules-repository/i18n/kimu-global-lang.ts +26 -0
- package/src/modules-repository/i18n/kimu-i18n-service.ts +108 -0
- package/src/modules-repository/i18n/manifest.json +22 -0
- package/src/modules-repository/i18n/module.ts +39 -0
- package/src/modules-repository/notification/README.md +423 -0
- package/src/modules-repository/notification/module.ts +30 -0
- package/src/modules-repository/notification/notification-service.ts +436 -0
- package/src/modules-repository/router/README.it.md +39 -0
- package/src/modules-repository/router/README.md +39 -0
- package/src/modules-repository/router/manifest.json +21 -0
- package/src/modules-repository/router/module.ts +23 -0
- package/src/modules-repository/router/router.ts +144 -0
- package/src/modules-repository/state/README.md +409 -0
- package/src/modules-repository/state/module.ts +30 -0
- package/src/modules-repository/state/state-service.ts +296 -0
- package/src/modules-repository/theme/README.md +267 -0
- package/src/modules-repository/theme/module.ts +30 -0
- package/src/modules-repository/theme/pre-build.js +40 -0
- package/src/modules-repository/theme/theme-service.ts +389 -0
- package/src/modules-repository/theme/themes/theme-cherry-blossom.css +78 -0
- package/src/modules-repository/theme/themes/theme-cozy.css +111 -0
- package/src/modules-repository/theme/themes/theme-cyberpunk.css +150 -0
- package/src/modules-repository/theme/themes/theme-dark.css +79 -0
- package/src/modules-repository/theme/themes/theme-forest.css +171 -0
- package/src/modules-repository/theme/themes/theme-gold.css +100 -0
- package/src/modules-repository/theme/themes/theme-high-contrast.css +126 -0
- package/src/modules-repository/theme/themes/theme-lava.css +101 -0
- package/src/modules-repository/theme/themes/theme-lavender.css +90 -0
- package/src/modules-repository/theme/themes/theme-light.css +79 -0
- package/src/modules-repository/theme/themes/theme-matrix.css +103 -0
- package/src/modules-repository/theme/themes/theme-midnight.css +81 -0
- package/src/modules-repository/theme/themes/theme-nord.css +94 -0
- package/src/modules-repository/theme/themes/theme-ocean.css +84 -0
- package/src/modules-repository/theme/themes/theme-retro80s.css +343 -0
- package/src/modules-repository/theme/themes/theme-sunset.css +62 -0
- package/src/modules-repository/theme/themes-config.d.ts +27 -0
- package/src/modules-repository/theme/themes-config.json +213 -0
- package/src/vite-env.d.ts +1 -0
- package/tsconfig.json +33 -0
- package/vite.config.ts +99 -0
package/vite.config.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import copy from 'rollup-plugin-copy';
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
|
|
6
|
+
// Function to get base path from KIMU config or environment variable
|
|
7
|
+
function getBasePath(): string {
|
|
8
|
+
try {
|
|
9
|
+
// Try to read from generated KIMU config first
|
|
10
|
+
const configPath = path.resolve('./src/config/kimu-build-config.ts');
|
|
11
|
+
if (fs.existsSync(configPath)) {
|
|
12
|
+
const configContent = fs.readFileSync(configPath, 'utf-8');
|
|
13
|
+
const match = configContent.match(/"base-path":\s*"([^"]+)"/);
|
|
14
|
+
if (match && match[1]) {
|
|
15
|
+
console.log(`[VITE] 🔧 Using base path from KIMU config: ${match[1]}`);
|
|
16
|
+
return match[1];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.log('[VITE] ⚠️ Could not read KIMU config, falling back to environment variable');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Fallback to environment variable or default
|
|
24
|
+
const envBasePath = process.env.KIMU_BASE_PATH || '/';
|
|
25
|
+
console.log(`[VITE] 🔧 Using base path from environment: ${envBasePath}`);
|
|
26
|
+
return envBasePath;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const basePath = getBasePath();
|
|
30
|
+
|
|
31
|
+
export default defineConfig({
|
|
32
|
+
root: 'src', // main folder of the project
|
|
33
|
+
base: basePath, // build base URL from environment or default to '/'
|
|
34
|
+
publicDir: '../public', // public folder for static files
|
|
35
|
+
build: {
|
|
36
|
+
minify: true, // enforce code minification (ESBuild - fast)
|
|
37
|
+
// For maximum compression (minimal gain ~30 bytes):
|
|
38
|
+
// 1. Install: npm install --save-dev terser
|
|
39
|
+
// 2. Change to: minify: 'terser'
|
|
40
|
+
// Trade-off: slower build time for marginal size reduction
|
|
41
|
+
outDir: '../dist',
|
|
42
|
+
emptyOutDir: true, // clear the destination folder before the build
|
|
43
|
+
target: 'es2020', // modern JS for smaller bundles
|
|
44
|
+
cssMinify: true, // minify CSS
|
|
45
|
+
sourcemap: false, // remove sourcemap for prod
|
|
46
|
+
reportCompressedSize: false, // speed up build
|
|
47
|
+
rollupOptions: { // rollup configuration options
|
|
48
|
+
output: {
|
|
49
|
+
manualChunks: {
|
|
50
|
+
// Separate vendor from app code
|
|
51
|
+
vendor: ['lit', 'idb']
|
|
52
|
+
},
|
|
53
|
+
chunkFileNames: 'chunks/[name]-[hash].js',
|
|
54
|
+
assetFileNames: 'assets/[name]-[hash][extname]'
|
|
55
|
+
},
|
|
56
|
+
external: [
|
|
57
|
+
// Mark external dependencies if possible
|
|
58
|
+
],
|
|
59
|
+
treeshake: {
|
|
60
|
+
moduleSideEffects: false, // enable aggressive tree shaking
|
|
61
|
+
propertyReadSideEffects: false,
|
|
62
|
+
unknownGlobalSideEffects: false
|
|
63
|
+
},
|
|
64
|
+
plugins: [
|
|
65
|
+
copy({
|
|
66
|
+
targets: [
|
|
67
|
+
// ✅ Copy LICENSE file to the final build
|
|
68
|
+
{ src: 'LICENSE', dest: 'dist', },
|
|
69
|
+
// ✅ Copy static assets (images, fonts, etc.) - CSS files are processed by Vite via HTML links
|
|
70
|
+
{ src: 'src/assets/*.{png,jpg,jpeg,svg,gif,webp,woff,woff2,ttf,eot,ico}', dest: 'dist', },
|
|
71
|
+
// ✅ Copy core files to the final build (exclude .ts files)
|
|
72
|
+
{ src: 'src/core/**/*.{js,json}', dest: 'dist' },
|
|
73
|
+
// ✅ Copy config files to the final build (exclude .ts files)
|
|
74
|
+
{ src: 'src/config/**/*.{js,json}', dest: 'dist' },
|
|
75
|
+
// ✅ Copy all JS and JSON files of modules to the final build
|
|
76
|
+
{ src: 'src/modules/**/*.{js,json}', dest: 'dist' },
|
|
77
|
+
// ✅ Copy HTML, CSS, and JS files of extensions to the final build
|
|
78
|
+
{ src: 'src/extensions/**/*.{html,css,js}', dest: 'dist', },
|
|
79
|
+
// ✅ Static assets of extensions (icons, images, media, etc.)
|
|
80
|
+
{ src: 'src/extensions/**/assets/**/*', dest: 'dist' },
|
|
81
|
+
// ✅ Useful resources of extensions (JSON, JS, properties, templates, etc.)
|
|
82
|
+
{ src: 'src/extensions/**/resources/**/*', dest: 'dist' },
|
|
83
|
+
// ✅ Language files of extensions (translation files)
|
|
84
|
+
{ src: 'src/extensions/**/lang/**/*', dest: 'dist' },
|
|
85
|
+
// ✅ Copy extensions-manifest.json to the final build
|
|
86
|
+
{ src: 'src/extensions/extensions-manifest.json', dest: 'dist' }
|
|
87
|
+
],
|
|
88
|
+
verbose: true, // show all messages for copied files
|
|
89
|
+
flatten: false, // keep folder structure
|
|
90
|
+
hook: 'writeBundle' // copy files after the bundle is written
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
server: {
|
|
96
|
+
host: true, // enable access from the local network
|
|
97
|
+
port: 5173 // default port for Vite
|
|
98
|
+
},
|
|
99
|
+
});
|