@sidekick-coder/zenith-kit 0.0.11 → 0.0.13

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 CHANGED
@@ -1,14 +1,17 @@
1
1
  {
2
2
  "name": "@sidekick-coder/zenith-kit",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "license": "MIT",
5
- "description": "A collection of utilities and tools for building language servers and related applications.",
6
- "keywords": [],
5
+ "description": "Package to use with zenith framework",
7
6
  "author": "Henrique Oliveira <henriqueoliwork@gmail.com>",
8
- "homepage": "https://github.com/sidekick-coder/language-kit",
7
+ "homepage": "https://github.com/sidekick-coder/zenith-kit",
8
+ "bin": {
9
+ "zkit": "./bin/zkit.js",
10
+ "zenith": "./bin/zenith.js"
11
+ },
9
12
  "repository": {
10
13
  "type": "git",
11
- "url": "git+https://github.com/sidekick-coder/language-kit.git"
14
+ "url": "git+https://github.com/sidekick-coder/zenith-kit.git"
12
15
  },
13
16
  "publishConfig": {
14
17
  "access": "public"
@@ -20,28 +23,51 @@
20
23
  },
21
24
  "exports": {
22
25
  "./shared": {
26
+ "types": "./dist/shared/index.d.mts",
23
27
  "import": "./dist/shared/index.mjs",
24
- "require": "./dist/shared/index.js",
25
- "types": "./dist/shared/index.d.mts"
28
+ "require": "./dist/shared/index.js"
26
29
  },
27
30
  "./server": {
31
+ "types": "./dist/server/index.d.mts",
28
32
  "import": "./dist/server/index.mjs",
29
- "require": "./dist/server/index.js",
30
- "types": "./dist/server/index.d.mts"
33
+ "require": "./dist/server/index.js"
34
+ },
35
+ "./client": {
36
+ "types": "./dist/client/index.d.mts",
37
+ "import": "./dist/client/index.mjs",
38
+ "require": "./dist/client/index.mjs"
39
+ },
40
+ "./components": {
41
+ "types": "./dist/components/index.d.mts",
42
+ "import": "./dist/components/index.es.js",
43
+ "require": "./dist/components/index.es.js"
44
+ },
45
+ "./vite": {
46
+ "import": "./vite/plugins/vite.js",
47
+ "require": "./vite/plugins/vite.js"
48
+ },
49
+ "./styles": "./dist/components/styles.css",
50
+ "./client-globals": {
51
+ "types": "./src/client/zenith-env.d.ts"
31
52
  }
32
53
  },
33
54
  "scripts": {
34
- "generate:indexes": "node indexes.js",
35
- "build": "tsdown",
36
- "watch": "tsdown --watch",
55
+ "build": "npm run build:tsdown && npm run build:vite",
56
+ "build:tsdown": "tsdown",
57
+ "build:vite": "vite build",
37
58
  "release": "node artisan.js release"
38
59
  },
39
60
  "devDependencies": {
40
61
  "@eslint/js": "^9.39.4",
41
62
  "@eslint/json": "^0.14.0",
63
+ "@types/express": "^5.0.6",
64
+ "@types/js-yaml": "^4.0.9",
42
65
  "@types/lodash-es": "^4.17.12",
66
+ "@types/mime": "^3.0.4",
67
+ "@types/ms": "^2.1.0",
43
68
  "@types/node": "^25.6.0",
44
69
  "@types/qs": "^6.15.0",
70
+ "@vue/language-core": "^3.1.8",
45
71
  "@vue/tsconfig": "^0.9.1",
46
72
  "commander": "^14.0.3",
47
73
  "eslint": "^9.39.4",
@@ -52,17 +78,44 @@
52
78
  "tsdown": "^0.21.9",
53
79
  "typescript": "^6.0.3",
54
80
  "typescript-eslint": "^8.58.2",
81
+ "vite-plugin-dts": "^5.0.0",
55
82
  "vitest": "^3.2.4"
56
83
  },
57
84
  "dependencies": {
85
+ "@aws-sdk/client-s3": "^3.1039.0",
86
+ "@aws-sdk/lib-storage": "^3.1039.0",
87
+ "@aws-sdk/s3-request-presigner": "^3.1039.0",
88
+ "@casl/ability": "^6.8.1",
89
+ "@rollup/pluginutils": "^5.3.0",
90
+ "@tailwindcss/vite": "^4.2.4",
91
+ "@unhead/vue": "^3.1.0",
92
+ "@vee-validate/valibot": "^4.15.1",
93
+ "@vitejs/plugin-vue": "^6.0.6",
58
94
  "better-sqlite3": "^12.9.0",
95
+ "class-variance-authority": "^0.7.1",
96
+ "cli-table3": "^0.6.5",
97
+ "clsx": "^2.1.1",
98
+ "cosmiconfig": "^9.0.1",
59
99
  "date-fns": "^4.1.0",
100
+ "dotenv": "^17.4.2",
101
+ "embla-carousel-vue": "^8.6.0",
60
102
  "fast-glob": "^3.3.3",
103
+ "js-yaml": "^4.1.1",
61
104
  "kysely": "^0.28.16",
62
105
  "lodash-es": "^4.18.1",
106
+ "lucide-vue-next": "^1.0.0",
107
+ "mime": "^4.1.0",
108
+ "ms": "^2.1.3",
63
109
  "mysql2": "^3.22.3",
64
110
  "pg": "^8.20.0",
65
111
  "qs": "^6.15.1",
66
- "valibot": "^1.3.1"
112
+ "reka-ui": "^2.9.6",
113
+ "tailwind-merge": "^3.5.0",
114
+ "tw-animate-css": "^1.4.0",
115
+ "valibot": "^1.3.1",
116
+ "vaul-vue": "^0.4.1",
117
+ "vee-validate": "^4.15.1",
118
+ "vue-router": "^5.0.6",
119
+ "vue-sonner": "^2.0.9"
67
120
  }
68
121
  }
@@ -18,8 +18,8 @@
18
18
  ]
19
19
  },
20
20
  "include": [
21
- "client/**/**/*.ts",
22
- "client/**/**/*.vue",
23
- "shared/**/**/*.ts"
21
+ "src/client/**/**/*.ts",
22
+ "src/client/**/**/*.vue",
23
+ "src/shared/**/**/*.ts"
24
24
  ]
25
25
  }
@@ -20,7 +20,7 @@
20
20
  "noUnusedParameters": true,
21
21
  "noFallthroughCasesInSwitch": true,
22
22
  "noUncheckedSideEffectImports": true,
23
- "strictPropertyInitialization": false,
23
+ "strictPropertyInitialization": false
24
24
  },
25
25
  "include": [
26
26
  "src/server/**/*.ts",
@@ -0,0 +1,29 @@
1
+ import { defineConfig } from 'tsdown'
2
+ import path from 'path'
3
+
4
+ /**
5
+ * @typedef {Object} Options
6
+ * @property {import('tsdown').UserConfig['root']} [root] - Root directory (default: current working directory)
7
+ * @property {import('tsdown').UserConfig['entry']} [entry] - Entry file or directory (default: `src/server/index.ts`)
8
+ * @property {string} [outDir] - Output directory (default: `dist/server`)
9
+ */
10
+
11
+ /**
12
+ * Vite plugin that replaces static and dynamic imports for specified modules
13
+ * with `globalThis.importAsync(...)` calls at transform time.
14
+ *
15
+ * @param {Options} options
16
+ */
17
+ export default function(options) {
18
+ const tsConfigPath = path.resolve(import.meta.dirname, '..', 'tsconfig.server.json')
19
+
20
+ return defineConfig({
21
+ root: options.root || process.cwd(),
22
+ entry: options.entry,
23
+ outDir: options.outDir || 'dist/server',
24
+ tsconfig: tsConfigPath,
25
+ minify: true,
26
+ unbundle: true,
27
+ })
28
+
29
+ }
package/tsdown.config.ts CHANGED
@@ -1,16 +1,19 @@
1
1
  import { defineConfig, globalLogger } from 'tsdown'
2
- import { generateIndexFile } from './src/shared/utils/generateIndexFile'
2
+ import { generateIndexFile } from './src/server/utils/generateIndexFile'
3
3
 
4
4
  export default defineConfig([
5
5
  {
6
6
  entry: 'src/shared/index.ts',
7
7
  outDir: 'dist/shared',
8
8
  tsconfig: 'tsconfig.shared.json',
9
+ dts: true,
10
+ minify: true,
11
+ sourcemap: 'inline',
9
12
  hooks(hooks) {
10
13
  hooks.hook('build:before', async () => {
11
14
  generateIndexFile({
12
15
  folders: [
13
- 'src/shared/services',
16
+ 'src/shared/services',
14
17
  'src/shared/utils',
15
18
  'src/shared/schemas',
16
19
  'src/shared/exceptions',
@@ -27,7 +30,19 @@ export default defineConfig([
27
30
  {
28
31
  entry: 'src/server/index.ts',
29
32
  outDir: 'dist/server',
33
+ dts: true,
34
+ minify: true,
35
+ sourcemap: 'inline',
30
36
  tsconfig: 'tsconfig.server.json',
37
+ deps: {
38
+ neverBundle: [
39
+ 'express',
40
+ 'kysely',
41
+ 'chalk',
42
+ 'commander',
43
+ '@unhead/vue',
44
+ ]
45
+ },
31
46
  hooks(hooks) {
32
47
  hooks.hook('build:before', async () => {
33
48
  generateIndexFile({
@@ -48,5 +63,40 @@ export default defineConfig([
48
63
  globalLogger.info('Generated index.ts for server')
49
64
  })
50
65
  }
51
- }
66
+ },
67
+ {
68
+ entry: 'src/client/index.ts',
69
+ outDir: 'dist/client',
70
+ dts: true,
71
+ minify: true,
72
+ sourcemap: 'inline',
73
+ tsconfig: 'tsconfig.client.json',
74
+ deps: {
75
+ neverBundle: [
76
+ 'vue',
77
+ 'vue-router',
78
+ '@unhead/vue',
79
+ ]
80
+ },
81
+ hooks(hooks) {
82
+ hooks.hook('build:before', async () => {
83
+ generateIndexFile({
84
+ folders: [
85
+ 'src/client/services',
86
+ 'src/client/repositories',
87
+ 'src/client/mixins',
88
+ 'src/client/facades',
89
+ 'src/client/loaders',
90
+ 'src/client/entities',
91
+ 'src/client/utils',
92
+ 'src/client/guards',
93
+ ],
94
+ filename: 'src/client/index.ts'
95
+ })
96
+
97
+ globalLogger.info('Generated index.ts for client')
98
+ })
99
+ }
100
+ },
101
+
52
102
  ])
@@ -0,0 +1,55 @@
1
+ import { defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import tailwindcss from '@tailwindcss/vite'
4
+ import zenith from './plugins/zenith.js'
5
+
6
+
7
+ /**
8
+ * @typedef {Object} Options
9
+ * @property {string} [name] - Library name (default: `server`)
10
+ * @property {string} [entry] - Entry file or directory (default: `src/server/index.ts`)
11
+ * @property {string} [outDir] - Output directory (default: `dist/server`)
12
+ * @property {boolean} [ssr] - Whether to build for SSR (default: `false`). If `true`, external dependencies will be treated as CommonJS modules. If `false`, they will be treated as ES modules.
13
+ */
14
+
15
+ /**
16
+ * Vite plugin that replaces static and dynamic imports for specified modules
17
+ * with `globalThis.importAsync(...)` calls at transform time.
18
+ *
19
+ * @param {Options} options
20
+ */
21
+ export default function(options) {
22
+ return defineConfig({
23
+ plugins: [
24
+ vue({
25
+ template: {
26
+ compilerOptions: {
27
+ isCustomElement: (tag) => {
28
+ return ['iconify-icon'].includes(tag)
29
+ }
30
+ }
31
+ }
32
+ }),
33
+ tailwindcss(),
34
+ zenith({
35
+ imports: [
36
+ 'vue',
37
+ 'vue-router',
38
+ ],
39
+ })
40
+ ],
41
+ build: {
42
+ outDir: options.outDir,
43
+ minify: true,
44
+ manifest: true,
45
+ ssr: options.ssr || false,
46
+ ssrManifest: options.ssr || false,
47
+ lib: {
48
+ name: options.name,
49
+ entry: options.entry,
50
+ formats: ['es'],
51
+ },
52
+ },
53
+ })
54
+ }
55
+
@@ -0,0 +1,143 @@
1
+ // @ts-check
2
+ import { createFilter } from '@rollup/pluginutils'
3
+ import MagicString from 'magic-string'
4
+ import * as acorn from 'acorn'
5
+
6
+ /**
7
+ * @typedef {Object} Options
8
+ * @property {string[]} [imports] - List of module names to replace with `globalThis.importAsync`
9
+ * @property {string | string[]} [include] - Files to include (default: `**\/*.{js,ts,vue}`)
10
+ * @property {string | string[]} [exclude] - Files to exclude (default: `node_modules/**`)
11
+ */
12
+
13
+ /**
14
+ * Vite plugin that replaces static and dynamic imports for specified modules
15
+ * with `globalThis.importAsync(...)` calls at transform time.
16
+ *
17
+ * @param {Options} options
18
+ * @returns {import('vite').Plugin}
19
+ */
20
+ export default function (options) {
21
+ const include = options?.include || '**/*.{js,ts,vue}'
22
+ const exclude = options?.exclude || 'node_modules/**'
23
+ const imports = options?.imports || []
24
+
25
+ const filter = createFilter(include, exclude)
26
+
27
+ return {
28
+ name: 'zenith',
29
+ enforce: 'post',
30
+
31
+ /**
32
+ * @param {string} code
33
+ * @param {string} id
34
+ */
35
+ transform(code, id) {
36
+ if (!filter(id)) return null
37
+
38
+ if (!code.includes('import')) return null
39
+
40
+ const s = new MagicString(code)
41
+ let hasChanges = false
42
+
43
+ const ast = /** @type {any} */ (acorn.parse(code, {
44
+ sourceType: 'module',
45
+ ecmaVersion: 2022,
46
+ }))
47
+
48
+ const modulesFromList = imports
49
+
50
+ /**
51
+ * @param {string} importSource
52
+ * @returns {boolean}
53
+ */
54
+ function shouldReplaceImport(importSource) {
55
+ const isExternalModule = modulesFromList.includes(importSource)
56
+ const isExternalModuleSubpath = modulesFromList.some(baseModule =>
57
+ importSource.startsWith(baseModule + '/') && importSource !== baseModule
58
+ )
59
+
60
+ return isExternalModule || isExternalModuleSubpath
61
+ }
62
+
63
+ /**
64
+ * @param {any} node
65
+ */
66
+ function walkNode(node) {
67
+ if (!node || typeof node !== 'object') return
68
+
69
+ if (node.type === 'ImportExpression' && node.source?.value) {
70
+ const importSource = node.source.value
71
+
72
+ if (shouldReplaceImport(importSource)) {
73
+ const replacement = `globalThis.importAsync("${importSource}")`
74
+ s.overwrite(node.start, node.end, replacement)
75
+ hasChanges = true
76
+ }
77
+ }
78
+
79
+ for (const key in node) {
80
+ if (key === 'start' || key === 'end' || key === 'type') continue
81
+ const child = node[key]
82
+ if (Array.isArray(child)) {
83
+ child.forEach(walkNode)
84
+ } else {
85
+ walkNode(child)
86
+ }
87
+ }
88
+ }
89
+
90
+ walkNode(ast)
91
+
92
+ const importNodes = ast.body.filter((/** @type {any} */ node) => node.type === 'ImportDeclaration').reverse()
93
+
94
+ for (const node of importNodes) {
95
+ const importSource = node.source.value
96
+
97
+ if (shouldReplaceImport(importSource)) {
98
+ if (node.specifiers.length === 0) {
99
+ const replacement = `await globalThis.importAsync("${importSource}");`
100
+ s.overwrite(node.start, node.end, replacement)
101
+ hasChanges = true
102
+ } else {
103
+ const replacements = node.specifiers
104
+ .map((/** @type {any} */ spec) => {
105
+ const localName = spec.local.name
106
+ let replacement = ''
107
+
108
+ if (spec.type === 'ImportSpecifier') {
109
+ const importedName = spec.imported.name
110
+ replacement = `const { ${importedName}: ${localName} } = await globalThis.importAsync("${importSource}");`
111
+ }
112
+
113
+ if (spec.type === 'ImportDefaultSpecifier') {
114
+ const moduleVarName = `__module__${localName}__`
115
+ replacement = `const ${moduleVarName} = await globalThis.importAsync("${importSource}"); const ${localName} = ${moduleVarName}.default || ${moduleVarName};`
116
+ }
117
+
118
+ if (spec.type === 'ImportNamespaceSpecifier') {
119
+ replacement = `const ${localName} = await globalThis.importAsync("${importSource}");`
120
+ }
121
+
122
+ return replacement
123
+ })
124
+ .filter(Boolean)
125
+ .join('\n')
126
+
127
+ if (replacements) {
128
+ s.overwrite(node.start, node.end, replacements)
129
+ hasChanges = true
130
+ }
131
+ }
132
+ }
133
+ }
134
+
135
+ if (!hasChanges) return null
136
+
137
+ return {
138
+ code: s.toString(),
139
+ map: s.generateMap({ hires: true }),
140
+ }
141
+ },
142
+ }
143
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,71 @@
1
+ import { createLogger, defineConfig } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import tailwindcss from '@tailwindcss/vite'
4
+ // import { importReplacer } from './src/build/vite'
5
+ import { generateIndexFile } from '#server/utils/generateIndexFile.ts'
6
+ import dts from 'vite-plugin-dts'
7
+
8
+ const logger = createLogger()
9
+
10
+ const prebuild = () => ({
11
+ name: 'prebuild',
12
+ buildStart() {
13
+ generateIndexFile({
14
+ glob: '**/*.{ts,vue,css}',
15
+ folders: [
16
+ // 'src/client/composables',
17
+ // 'src/client/utils',
18
+ // 'src/client/facades',
19
+ 'src/client/components',
20
+ 'src/client/layouts',
21
+ // 'src/client/services',
22
+ // 'src/client/guards',
23
+ 'src/client/css',
24
+ ],
25
+ filename: 'src/client/components.ts'
26
+ })
27
+
28
+ logger.info('Generated index.ts for client')
29
+ }
30
+ })
31
+
32
+ const externals = [
33
+ 'vue',
34
+ 'vue-router',
35
+ ]
36
+
37
+ export default defineConfig({
38
+ customLogger: logger,
39
+ plugins: [
40
+ vue({
41
+ template: {
42
+ compilerOptions: {
43
+ isCustomElement: (tag) => {
44
+ return ['iconify-icon'].includes(tag)
45
+ }
46
+ }
47
+ }
48
+ }),
49
+ // dts({
50
+ // entryRoot: 'src/client/index.ts',
51
+ // tsconfigPath: 'tsconfig.client.json',
52
+ // bundleTypes: true,
53
+ // }),
54
+ tailwindcss(),
55
+ prebuild(),
56
+ ],
57
+ build: {
58
+ outDir: 'dist/components',
59
+ minify: false,
60
+ rollupOptions: {
61
+ external: externals,
62
+ },
63
+ lib: {
64
+ name: 'Client',
65
+ entry: 'src/client/components.ts',
66
+ formats: ['es'],
67
+ fileName: (format) => `index.${format}.js`,
68
+ cssFileName: 'styles',
69
+ },
70
+ },
71
+ })
@@ -1,13 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true
8
- });
9
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
- return target;
11
- };
12
- //#endregion
13
- export { __exportAll as t };