@kong/kongponents 9.43.3-pr.2953.6ec956d.0 → 9.43.3-pr.2953.d3d2c2f.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/dist/nuxt/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponent, useLogger, addImportsDir } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponent, useLogger, addImportsDir, addTypeTemplate } from '@nuxt/kit';
|
|
2
2
|
import { components } from '@kong/kongponents';
|
|
3
3
|
// Components that should always be excluded from auto-registration
|
|
4
4
|
const ALWAYS_EXCLUDE_COMPONENTS = ['ToastManager', 'KTable', 'KModalFullscreen', 'KDropdownMenu'];
|
|
@@ -22,6 +22,16 @@ export default defineNuxtModule({
|
|
|
22
22
|
if (options.composables) {
|
|
23
23
|
// Register composables
|
|
24
24
|
addImportsDir(resolve('./runtime/composables'));
|
|
25
|
+
// we need explicitly provide and register type declarations for module-injected composables
|
|
26
|
+
addTypeTemplate({
|
|
27
|
+
filename: 'types/use-toast.d.ts',
|
|
28
|
+
getContents: () => `
|
|
29
|
+
import type { Toast } from '@kong/kongponents'
|
|
30
|
+
declare module '#imports' {
|
|
31
|
+
export function useToast(): { showToast(notification: Partial<Toast>): Promise<void> }
|
|
32
|
+
}
|
|
33
|
+
`,
|
|
34
|
+
});
|
|
25
35
|
}
|
|
26
36
|
// Define a list of components that should be auto-registered.
|
|
27
37
|
const includeList = options.components?.include || [];
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// TODO: testing some stuff...
|
|
2
|
-
// @ts-ignore - import path exists
|
|
3
|
-
import { defineNuxtPlugin } from '#app';
|
|
4
|
-
// In some NodeJS environments, the `crypto` module is not available by default, so import it and make it available on the server
|
|
5
|
-
import crypto from 'node:crypto';
|
|
6
|
-
export default defineNuxtPlugin({
|
|
7
|
-
name: 'kongponents',
|
|
8
|
-
setup() {
|
|
9
|
-
// Inject the crypto module into the global scope if it is not already available
|
|
10
|
-
if (import.meta.server && typeof globalThis?.crypto === 'undefined') {
|
|
11
|
-
globalThis.crypto = globalThis.crypto || crypto;
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
});
|