@tickboxhq/nuxt 0.0.9 → 0.0.11
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/module.json +1 -1
- package/dist/module.mjs +20 -1
- package/package.json +3 -3
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
1
2
|
import { defineNuxtModule, createResolver, resolveAlias, addTemplate, addPlugin, addImports, addComponent, addServerHandler } from '@nuxt/kit';
|
|
2
3
|
|
|
3
4
|
const tickboxModule = defineNuxtModule({
|
|
@@ -20,7 +21,11 @@ const tickboxModule = defineNuxtModule({
|
|
|
20
21
|
"~~": nuxt.options.rootDir,
|
|
21
22
|
"@@": nuxt.options.rootDir
|
|
22
23
|
};
|
|
23
|
-
const
|
|
24
|
+
const resolvedConfigPathWithoutExt = resolveAlias(
|
|
25
|
+
options.configPath ?? "~/consent.config",
|
|
26
|
+
aliases
|
|
27
|
+
);
|
|
28
|
+
const resolvedConfigPath = findExisting(resolvedConfigPathWithoutExt) ?? resolvedConfigPathWithoutExt;
|
|
24
29
|
const templateFile = `${nuxt.options.buildDir}/tickbox-config.mjs`;
|
|
25
30
|
addTemplate({
|
|
26
31
|
filename: "tickbox-config.mjs",
|
|
@@ -45,6 +50,11 @@ const tickboxModule = defineNuxtModule({
|
|
|
45
50
|
filePath: "@tickboxhq/vue",
|
|
46
51
|
export: "ConsentBanner"
|
|
47
52
|
});
|
|
53
|
+
addComponent({
|
|
54
|
+
name: "ConsentNotice",
|
|
55
|
+
filePath: "@tickboxhq/vue",
|
|
56
|
+
export: "ConsentNotice"
|
|
57
|
+
});
|
|
48
58
|
if (options.aiTxt !== false) {
|
|
49
59
|
addServerHandler({
|
|
50
60
|
route: "/ai.txt",
|
|
@@ -53,5 +63,14 @@ const tickboxModule = defineNuxtModule({
|
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
65
|
});
|
|
66
|
+
function findExisting(basePath) {
|
|
67
|
+
if (existsSync(basePath))
|
|
68
|
+
return basePath;
|
|
69
|
+
for (const ext of [".ts", ".mts", ".mjs", ".js", ".cjs"]) {
|
|
70
|
+
if (existsSync(`${basePath}${ext}`))
|
|
71
|
+
return `${basePath}${ext}`;
|
|
72
|
+
}
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
56
75
|
|
|
57
76
|
export { tickboxModule as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tickboxhq/nuxt",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11",
|
|
4
4
|
"description": "Nuxt 3/4 module for Tickbox consent management",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://tickbox.dev",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@nuxt/kit": "^3.13.0",
|
|
32
|
-
"@tickboxhq/core": "0.0.
|
|
33
|
-
"@tickboxhq/vue": "0.0.
|
|
32
|
+
"@tickboxhq/core": "0.0.11",
|
|
33
|
+
"@tickboxhq/vue": "0.0.11"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"nuxt": "^3.0.0 || ^4.0.0"
|