@frontic/nuxt 0.1.5 → 0.1.7
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/LICENSE +21 -0
- package/dist/module.mjs +32 -26
- package/package.json +14 -14
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Frontic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/module.mjs
CHANGED
|
@@ -51,16 +51,19 @@ const module$1 = defineNuxtModule({
|
|
|
51
51
|
const { resolve, resolvePath } = createResolver(ROOT_DIR_PATH);
|
|
52
52
|
const { resolve: resolveModule } = createResolver(_dirname);
|
|
53
53
|
const runtimeDir = resolveModule("./runtime");
|
|
54
|
+
const fronticClientFile = "generated-client.ts";
|
|
55
|
+
const fronticDir = join(ROOT_DIR_PATH, ".frontic");
|
|
56
|
+
const frontstackDir = join(ROOT_DIR_PATH, ".frontstack");
|
|
57
|
+
const fronticClientDir = existsSync(join(fronticDir, fronticClientFile)) ? fronticDir : frontstackDir;
|
|
58
|
+
const fronticClientPath = join(fronticClientDir, fronticClientFile);
|
|
59
|
+
const hasFronticClient = existsSync(fronticClientPath);
|
|
54
60
|
const proxyPath = typeof proxyConfig === "string" ? proxyConfig : proxyConfig !== false ? "/api/stack" : void 0;
|
|
55
|
-
if (proxyPath) {
|
|
61
|
+
if (proxyPath && hasFronticClient) {
|
|
56
62
|
addServerHandler({
|
|
57
63
|
route: `${proxyPath}/**`,
|
|
58
|
-
handler: resolveModule("./runtime/server/api/
|
|
64
|
+
handler: resolveModule("./runtime/server/api/frontic/[...path]")
|
|
59
65
|
});
|
|
60
66
|
}
|
|
61
|
-
const fronticClientDir = join(ROOT_DIR_PATH, ".frontstack");
|
|
62
|
-
const fronticClientPath = join(fronticClientDir, "generated-client.ts");
|
|
63
|
-
const hasFronticClient = existsSync(fronticClientPath);
|
|
64
67
|
const blockEnabled = isComposableEnabled(composablesConfig, "block");
|
|
65
68
|
const listingEnabled = isComposableEnabled(composablesConfig, "listing");
|
|
66
69
|
const searchEnabled = isComposableEnabled(composablesConfig, "search");
|
|
@@ -75,17 +78,18 @@ const module$1 = defineNuxtModule({
|
|
|
75
78
|
});
|
|
76
79
|
console.warn(
|
|
77
80
|
`
|
|
78
|
-
[@frontic/nuxt] Frontic client not found at .
|
|
81
|
+
[@frontic/nuxt] Frontic client not found at .frontic directory
|
|
79
82
|
The following composables require the Frontic client: ${enabledList.join(", ")}
|
|
80
83
|
Run \`npx @frontic/cli generate\` to generate the client, or disable composables:
|
|
81
84
|
frontic: { composables: false }
|
|
82
85
|
`
|
|
83
86
|
);
|
|
84
87
|
}
|
|
88
|
+
const clientDirName = fronticClientDir === fronticDir ? ".frontic" : ".frontstack";
|
|
85
89
|
nuxt.hook("prepare:types", ({ tsConfig }) => {
|
|
86
90
|
tsConfig.compilerOptions ||= {};
|
|
87
91
|
tsConfig.compilerOptions.paths ||= {};
|
|
88
|
-
tsConfig.compilerOptions.paths["@frontic/stack/*"] = [
|
|
92
|
+
tsConfig.compilerOptions.paths["@frontic/stack/*"] = [`../${clientDirName}/*`];
|
|
89
93
|
});
|
|
90
94
|
if (anyComposableEnabled) {
|
|
91
95
|
const composablesDir = resolve(runtimeDir, "composables");
|
|
@@ -178,25 +182,27 @@ frontic: { composables: false }
|
|
|
178
182
|
prepend: true
|
|
179
183
|
}
|
|
180
184
|
);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
185
|
+
if (existsSync(componentsPath)) {
|
|
186
|
+
try {
|
|
187
|
+
await Promise.all(
|
|
188
|
+
readdirSync(componentsPath).map(async (dir) => {
|
|
189
|
+
try {
|
|
190
|
+
const filePath = await resolvePath(join(COMPONENT_DIR_PATH, dir, "index"), {
|
|
191
|
+
extensions: [".ts", ".js"]
|
|
192
|
+
});
|
|
193
|
+
addComponentExports({
|
|
194
|
+
prefix,
|
|
195
|
+
filePath: resolve(filePath),
|
|
196
|
+
priority: 1
|
|
197
|
+
});
|
|
198
|
+
} catch (err) {
|
|
199
|
+
if (err instanceof Error) console.warn("Module error: ", err.message);
|
|
200
|
+
}
|
|
201
|
+
})
|
|
202
|
+
);
|
|
203
|
+
} catch (err) {
|
|
204
|
+
if (err instanceof Error) console.warn(err.message);
|
|
205
|
+
}
|
|
200
206
|
}
|
|
201
207
|
}
|
|
202
208
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontic/nuxt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Nuxt module for Frontstack headless commerce - zero config data fetching composables with smart caching, page routing, and context management",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Frontic",
|
|
@@ -39,21 +39,11 @@
|
|
|
39
39
|
"dist",
|
|
40
40
|
"README.md"
|
|
41
41
|
],
|
|
42
|
-
"scripts": {
|
|
43
|
-
"prepack": "nuxt-module-build build",
|
|
44
|
-
"dev": "nuxi dev playground",
|
|
45
|
-
"dev:build": "nuxi build playground",
|
|
46
|
-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
47
|
-
"build": "nuxt-module-build build",
|
|
48
|
-
"typecheck": "vue-tsc --noEmit",
|
|
49
|
-
"test": "vitest run",
|
|
50
|
-
"test:watch": "vitest watch",
|
|
51
|
-
"clean": "rm -rf dist .nuxt"
|
|
52
|
-
},
|
|
53
42
|
"dependencies": {
|
|
54
43
|
"@nuxt/kit": "^3.17.0",
|
|
55
44
|
"@pinia/colada": "^0.14.0",
|
|
56
|
-
"@vueuse/core": "^12.0.0"
|
|
45
|
+
"@vueuse/core": "^12.0.0",
|
|
46
|
+
"pinia": "^2.2.6"
|
|
57
47
|
},
|
|
58
48
|
"devDependencies": {
|
|
59
49
|
"@nuxt/module-builder": "^1.0.2",
|
|
@@ -67,5 +57,15 @@
|
|
|
67
57
|
},
|
|
68
58
|
"peerDependencies": {
|
|
69
59
|
"nuxt": ">=3.17.0"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"dev": "nuxi dev playground",
|
|
63
|
+
"dev:build": "nuxi build playground",
|
|
64
|
+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
|
|
65
|
+
"build": "nuxt-module-build build",
|
|
66
|
+
"typecheck": "vue-tsc --noEmit",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"test:watch": "vitest watch",
|
|
69
|
+
"clean": "rm -rf dist .nuxt"
|
|
70
70
|
}
|
|
71
|
-
}
|
|
71
|
+
}
|