@htlkg/astro 0.0.25 → 0.0.26
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/vue-app-setup.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { Amplify } from "aws-amplify";
|
|
3
3
|
import { htlkgConfig } from "virtual:htlkg";
|
|
4
4
|
function setupVueApp(app) {
|
|
5
|
+
console.log("[htlkg vue-app-setup] Setting up Vue app...");
|
|
6
|
+
console.log("[htlkg vue-app-setup] htlkgConfig:", htlkgConfig);
|
|
5
7
|
if (import.meta.env.DEV && typeof window !== "undefined") {
|
|
6
8
|
try {
|
|
7
9
|
import("@nanostores/vue/devtools").then(({ devtools }) => {
|
|
@@ -13,12 +15,15 @@ function setupVueApp(app) {
|
|
|
13
15
|
}
|
|
14
16
|
try {
|
|
15
17
|
const { amplifyConfig } = htlkgConfig;
|
|
18
|
+
console.log("[htlkg vue-app-setup] amplifyConfig:", amplifyConfig);
|
|
16
19
|
if (!amplifyConfig) {
|
|
17
20
|
console.warn("[htlkg] No Amplify configuration provided");
|
|
18
21
|
return;
|
|
19
22
|
}
|
|
20
23
|
if ("auth" in amplifyConfig || "data" in amplifyConfig || "storage" in amplifyConfig) {
|
|
24
|
+
console.log("[htlkg vue-app-setup] Configuring Amplify with full config...");
|
|
21
25
|
Amplify.configure(amplifyConfig, { ssr: true });
|
|
26
|
+
console.log("[htlkg vue-app-setup] Amplify configured successfully!");
|
|
22
27
|
} else {
|
|
23
28
|
const { userPoolId, userPoolClientId, region } = amplifyConfig;
|
|
24
29
|
if (userPoolId && userPoolClientId) {
|
|
@@ -31,7 +36,9 @@ function setupVueApp(app) {
|
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
};
|
|
39
|
+
console.log("[htlkg vue-app-setup] Configuring Amplify with legacy config...");
|
|
34
40
|
Amplify.configure(config, { ssr: true });
|
|
41
|
+
console.log("[htlkg vue-app-setup] Amplify configured successfully!");
|
|
35
42
|
} else {
|
|
36
43
|
console.error(
|
|
37
44
|
"[htlkg] Missing required Amplify configuration (userPoolId, userPoolClientId)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vue-app-setup.ts"],"sourcesContent":["/**\n * Vue App Setup for htlkg Integration\n *\n * This file is automatically loaded by the Vue integration when vueAppSetup is enabled.\n * It configures AWS Amplify for client-side authentication in all Vue components.\n * It also sets up nanostores devtools integration for Vue DevTools.\n */\n\n/// <reference types=\"vite/client\" />\n\nimport type { App } from \"vue\";\nimport type { ResourcesConfig } from \"aws-amplify\";\nimport { Amplify } from \"aws-amplify\";\nimport { htlkgConfig } from \"virtual:htlkg\";\n\n/**\n * Setup function called by Astro's Vue integration\n * Configures Amplify for client-side authentication and nanostores devtools\n */\nexport default function setupVueApp(app: App): void {\n\t// Setup nanostores devtools in development\n\t// The devtools plugin will automatically detect stores used in components\n\tif (import.meta.env.DEV && typeof window !== 'undefined') {\n\t\ttry {\n\t\t\t// Dynamically import devtools plugin (only in browser)\n\t\t\timport('@nanostores/vue/devtools').then(({ devtools }) => {\n\t\t\t\t// Install devtools plugin - it will detect stores automatically\n\t\t\t\tapp.use(devtools, {});\n\t\t\t}).catch(() => {\n\t\t\t\t// Silently ignore - devtools are optional\n\t\t\t});\n\t\t} catch {\n\t\t\t// Silently ignore - devtools are optional\n\t\t}\n\t}\n\n\t// Setup Amplify\n\ttry {\n\t\tconst { amplifyConfig } = htlkgConfig;\n\t\tif (!amplifyConfig) {\n\t\t\tconsole.warn(\"[htlkg] No Amplify configuration provided\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if this is a full amplify_outputs.json config\n\t\tif (\n\t\t\t\"auth\" in amplifyConfig ||\n\t\t\t\"data\" in amplifyConfig ||\n\t\t\t\"storage\" in amplifyConfig\n\t\t) {\n\t\t\tAmplify.configure(amplifyConfig as ResourcesConfig, { ssr: true });\n\t\t} else {\n\t\t\t// Legacy individual config properties\n\t\t\tconst { userPoolId, userPoolClientId, region } = amplifyConfig as {\n\t\t\t\tuserPoolId?: string;\n\t\t\t\tuserPoolClientId?: string;\n\t\t\t\tregion?: string;\n\t\t\t};\n\n\t\t\tif (userPoolId && userPoolClientId) {\n\t\t\t\tconst config: ResourcesConfig = {\n\t\t\t\t\tAuth: {\n\t\t\t\t\t\tCognito: {\n\t\t\t\t\t\t\tuserPoolId,\n\t\t\t\t\t\t\tuserPoolClientId,\n\t\t\t\t\t\t\t...(region && { region }),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tAmplify.configure(config, { ssr: true });\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t\"[htlkg] Missing required Amplify configuration (userPoolId, userPoolClientId)\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.error(\"[htlkg] Failed to setup Vue app:\", error);\n\t\t// Don't throw - allow app to continue even if Amplify setup fails\n\t}\n}\n"],"mappings":";AAYA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAMb,SAAR,YAA6B,KAAgB;
|
|
1
|
+
{"version":3,"sources":["../src/vue-app-setup.ts"],"sourcesContent":["/**\n * Vue App Setup for htlkg Integration\n *\n * This file is automatically loaded by the Vue integration when vueAppSetup is enabled.\n * It configures AWS Amplify for client-side authentication in all Vue components.\n * It also sets up nanostores devtools integration for Vue DevTools.\n */\n\n/// <reference types=\"vite/client\" />\n\nimport type { App } from \"vue\";\nimport type { ResourcesConfig } from \"aws-amplify\";\nimport { Amplify } from \"aws-amplify\";\nimport { htlkgConfig } from \"virtual:htlkg\";\n\n/**\n * Setup function called by Astro's Vue integration\n * Configures Amplify for client-side authentication and nanostores devtools\n */\nexport default function setupVueApp(app: App): void {\n\tconsole.log(\"[htlkg vue-app-setup] Setting up Vue app...\");\n\tconsole.log(\"[htlkg vue-app-setup] htlkgConfig:\", htlkgConfig);\n\n\t// Setup nanostores devtools in development\n\t// The devtools plugin will automatically detect stores used in components\n\tif (import.meta.env.DEV && typeof window !== 'undefined') {\n\t\ttry {\n\t\t\t// Dynamically import devtools plugin (only in browser)\n\t\t\timport('@nanostores/vue/devtools').then(({ devtools }) => {\n\t\t\t\t// Install devtools plugin - it will detect stores automatically\n\t\t\t\tapp.use(devtools, {});\n\t\t\t}).catch(() => {\n\t\t\t\t// Silently ignore - devtools are optional\n\t\t\t});\n\t\t} catch {\n\t\t\t// Silently ignore - devtools are optional\n\t\t}\n\t}\n\n\t// Setup Amplify\n\ttry {\n\t\tconst { amplifyConfig } = htlkgConfig;\n\t\tconsole.log(\"[htlkg vue-app-setup] amplifyConfig:\", amplifyConfig);\n\n\t\tif (!amplifyConfig) {\n\t\t\tconsole.warn(\"[htlkg] No Amplify configuration provided\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Check if this is a full amplify_outputs.json config\n\t\tif (\n\t\t\t\"auth\" in amplifyConfig ||\n\t\t\t\"data\" in amplifyConfig ||\n\t\t\t\"storage\" in amplifyConfig\n\t\t) {\n\t\t\tconsole.log(\"[htlkg vue-app-setup] Configuring Amplify with full config...\");\n\t\t\tAmplify.configure(amplifyConfig as ResourcesConfig, { ssr: true });\n\t\t\tconsole.log(\"[htlkg vue-app-setup] Amplify configured successfully!\");\n\t\t} else {\n\t\t\t// Legacy individual config properties\n\t\t\tconst { userPoolId, userPoolClientId, region } = amplifyConfig as {\n\t\t\t\tuserPoolId?: string;\n\t\t\t\tuserPoolClientId?: string;\n\t\t\t\tregion?: string;\n\t\t\t};\n\n\t\t\tif (userPoolId && userPoolClientId) {\n\t\t\t\tconst config: ResourcesConfig = {\n\t\t\t\t\tAuth: {\n\t\t\t\t\t\tCognito: {\n\t\t\t\t\t\t\tuserPoolId,\n\t\t\t\t\t\t\tuserPoolClientId,\n\t\t\t\t\t\t\t...(region && { region }),\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tconsole.log(\"[htlkg vue-app-setup] Configuring Amplify with legacy config...\");\n\t\t\t\tAmplify.configure(config, { ssr: true });\n\t\t\t\tconsole.log(\"[htlkg vue-app-setup] Amplify configured successfully!\");\n\t\t\t} else {\n\t\t\t\tconsole.error(\n\t\t\t\t\t\"[htlkg] Missing required Amplify configuration (userPoolId, userPoolClientId)\",\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tconsole.error(\"[htlkg] Failed to setup Vue app:\", error);\n\t\t// Don't throw - allow app to continue even if Amplify setup fails\n\t}\n}\n"],"mappings":";AAYA,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAMb,SAAR,YAA6B,KAAgB;AACnD,UAAQ,IAAI,6CAA6C;AACzD,UAAQ,IAAI,sCAAsC,WAAW;AAI7D,MAAI,YAAY,IAAI,OAAO,OAAO,WAAW,aAAa;AACzD,QAAI;AAEH,aAAO,0BAA0B,EAAE,KAAK,CAAC,EAAE,SAAS,MAAM;AAEzD,YAAI,IAAI,UAAU,CAAC,CAAC;AAAA,MACrB,CAAC,EAAE,MAAM,MAAM;AAAA,MAEf,CAAC;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACD;AAGA,MAAI;AACH,UAAM,EAAE,cAAc,IAAI;AAC1B,YAAQ,IAAI,wCAAwC,aAAa;AAEjE,QAAI,CAAC,eAAe;AACnB,cAAQ,KAAK,2CAA2C;AACxD;AAAA,IACD;AAGA,QACC,UAAU,iBACV,UAAU,iBACV,aAAa,eACZ;AACD,cAAQ,IAAI,+DAA+D;AAC3E,cAAQ,UAAU,eAAkC,EAAE,KAAK,KAAK,CAAC;AACjE,cAAQ,IAAI,wDAAwD;AAAA,IACrE,OAAO;AAEN,YAAM,EAAE,YAAY,kBAAkB,OAAO,IAAI;AAMjD,UAAI,cAAc,kBAAkB;AACnC,cAAM,SAA0B;AAAA,UAC/B,MAAM;AAAA,YACL,SAAS;AAAA,cACR;AAAA,cACA;AAAA,cACA,GAAI,UAAU,EAAE,OAAO;AAAA,YACxB;AAAA,UACD;AAAA,QACD;AAEA,gBAAQ,IAAI,iEAAiE;AAC7E,gBAAQ,UAAU,QAAQ,EAAE,KAAK,KAAK,CAAC;AACvC,gBAAQ,IAAI,wDAAwD;AAAA,MACrE,OAAO;AACN,gBAAQ;AAAA,UACP;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD,SAAS,OAAO;AACf,YAAQ,MAAM,oCAAoC,KAAK;AAAA,EAExD;AACD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@htlkg/astro",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@nanostores/vue": "^1.0.1",
|
|
66
66
|
"nanostores": "^1.0.1",
|
|
67
67
|
"vue": "^3.5.22",
|
|
68
|
-
"@htlkg/
|
|
69
|
-
"@htlkg/
|
|
68
|
+
"@htlkg/components": "0.0.11",
|
|
69
|
+
"@htlkg/core": "0.0.14"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"astro": "^5.0.0",
|
package/src/vue-app-setup.ts
CHANGED
|
@@ -18,6 +18,9 @@ import { htlkgConfig } from "virtual:htlkg";
|
|
|
18
18
|
* Configures Amplify for client-side authentication and nanostores devtools
|
|
19
19
|
*/
|
|
20
20
|
export default function setupVueApp(app: App): void {
|
|
21
|
+
console.log("[htlkg vue-app-setup] Setting up Vue app...");
|
|
22
|
+
console.log("[htlkg vue-app-setup] htlkgConfig:", htlkgConfig);
|
|
23
|
+
|
|
21
24
|
// Setup nanostores devtools in development
|
|
22
25
|
// The devtools plugin will automatically detect stores used in components
|
|
23
26
|
if (import.meta.env.DEV && typeof window !== 'undefined') {
|
|
@@ -37,6 +40,8 @@ export default function setupVueApp(app: App): void {
|
|
|
37
40
|
// Setup Amplify
|
|
38
41
|
try {
|
|
39
42
|
const { amplifyConfig } = htlkgConfig;
|
|
43
|
+
console.log("[htlkg vue-app-setup] amplifyConfig:", amplifyConfig);
|
|
44
|
+
|
|
40
45
|
if (!amplifyConfig) {
|
|
41
46
|
console.warn("[htlkg] No Amplify configuration provided");
|
|
42
47
|
return;
|
|
@@ -48,7 +53,9 @@ export default function setupVueApp(app: App): void {
|
|
|
48
53
|
"data" in amplifyConfig ||
|
|
49
54
|
"storage" in amplifyConfig
|
|
50
55
|
) {
|
|
56
|
+
console.log("[htlkg vue-app-setup] Configuring Amplify with full config...");
|
|
51
57
|
Amplify.configure(amplifyConfig as ResourcesConfig, { ssr: true });
|
|
58
|
+
console.log("[htlkg vue-app-setup] Amplify configured successfully!");
|
|
52
59
|
} else {
|
|
53
60
|
// Legacy individual config properties
|
|
54
61
|
const { userPoolId, userPoolClientId, region } = amplifyConfig as {
|
|
@@ -68,7 +75,9 @@ export default function setupVueApp(app: App): void {
|
|
|
68
75
|
},
|
|
69
76
|
};
|
|
70
77
|
|
|
78
|
+
console.log("[htlkg vue-app-setup] Configuring Amplify with legacy config...");
|
|
71
79
|
Amplify.configure(config, { ssr: true });
|
|
80
|
+
console.log("[htlkg vue-app-setup] Amplify configured successfully!");
|
|
72
81
|
} else {
|
|
73
82
|
console.error(
|
|
74
83
|
"[htlkg] Missing required Amplify configuration (userPoolId, userPoolClientId)",
|