@oaysus/cli 0.1.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.
Files changed (243) hide show
  1. package/README.md +166 -0
  2. package/bin/oaysus.js +6 -0
  3. package/dist/cli.d.ts +11 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +174 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/login.d.ts +2 -0
  8. package/dist/commands/login.d.ts.map +1 -0
  9. package/dist/commands/login.js +75 -0
  10. package/dist/commands/login.js.map +1 -0
  11. package/dist/commands/logout.d.ts +2 -0
  12. package/dist/commands/logout.d.ts.map +1 -0
  13. package/dist/commands/logout.js +23 -0
  14. package/dist/commands/logout.js.map +1 -0
  15. package/dist/commands/whoami.d.ts +2 -0
  16. package/dist/commands/whoami.d.ts.map +1 -0
  17. package/dist/commands/whoami.js +44 -0
  18. package/dist/commands/whoami.js.map +1 -0
  19. package/dist/components/App.d.ts +43 -0
  20. package/dist/components/App.d.ts.map +1 -0
  21. package/dist/components/App.js +63 -0
  22. package/dist/components/App.js.map +1 -0
  23. package/dist/components/BuildProgress.d.ts +16 -0
  24. package/dist/components/BuildProgress.d.ts.map +1 -0
  25. package/dist/components/BuildProgress.js +42 -0
  26. package/dist/components/BuildProgress.js.map +1 -0
  27. package/dist/components/ErrorMessage.d.ts +13 -0
  28. package/dist/components/ErrorMessage.d.ts.map +1 -0
  29. package/dist/components/ErrorMessage.js +29 -0
  30. package/dist/components/ErrorMessage.js.map +1 -0
  31. package/dist/components/FileList.d.ts +13 -0
  32. package/dist/components/FileList.d.ts.map +1 -0
  33. package/dist/components/FileList.js +25 -0
  34. package/dist/components/FileList.js.map +1 -0
  35. package/dist/components/Header.d.ts +12 -0
  36. package/dist/components/Header.d.ts.map +1 -0
  37. package/dist/components/Header.js +18 -0
  38. package/dist/components/Header.js.map +1 -0
  39. package/dist/components/LastCommand.d.ts +9 -0
  40. package/dist/components/LastCommand.d.ts.map +1 -0
  41. package/dist/components/LastCommand.js +39 -0
  42. package/dist/components/LastCommand.js.map +1 -0
  43. package/dist/components/Logo.d.ts +14 -0
  44. package/dist/components/Logo.d.ts.map +1 -0
  45. package/dist/components/Logo.js +44 -0
  46. package/dist/components/Logo.js.map +1 -0
  47. package/dist/components/ProgressBar.d.ts +13 -0
  48. package/dist/components/ProgressBar.d.ts.map +1 -0
  49. package/dist/components/ProgressBar.js +20 -0
  50. package/dist/components/ProgressBar.js.map +1 -0
  51. package/dist/components/SlashCommands.d.ts +17 -0
  52. package/dist/components/SlashCommands.d.ts.map +1 -0
  53. package/dist/components/SlashCommands.js +59 -0
  54. package/dist/components/SlashCommands.js.map +1 -0
  55. package/dist/components/Spinner.d.ts +13 -0
  56. package/dist/components/Spinner.d.ts.map +1 -0
  57. package/dist/components/Spinner.js +16 -0
  58. package/dist/components/Spinner.js.map +1 -0
  59. package/dist/components/StatusCard.d.ts +14 -0
  60. package/dist/components/StatusCard.d.ts.map +1 -0
  61. package/dist/components/StatusCard.js +40 -0
  62. package/dist/components/StatusCard.js.map +1 -0
  63. package/dist/components/SuccessMessage.d.ts +12 -0
  64. package/dist/components/SuccessMessage.d.ts.map +1 -0
  65. package/dist/components/SuccessMessage.js +18 -0
  66. package/dist/components/SuccessMessage.js.map +1 -0
  67. package/dist/components/UploadProgress.d.ts +13 -0
  68. package/dist/components/UploadProgress.d.ts.map +1 -0
  69. package/dist/components/UploadProgress.js +40 -0
  70. package/dist/components/UploadProgress.js.map +1 -0
  71. package/dist/components/ValidationProgress.d.ts +12 -0
  72. package/dist/components/ValidationProgress.d.ts.map +1 -0
  73. package/dist/components/ValidationProgress.js +44 -0
  74. package/dist/components/ValidationProgress.js.map +1 -0
  75. package/dist/index.d.ts +7 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +21 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/lib/core/framework-registry.d.ts +27 -0
  80. package/dist/lib/core/framework-registry.d.ts.map +1 -0
  81. package/dist/lib/core/framework-registry.js +67 -0
  82. package/dist/lib/core/framework-registry.js.map +1 -0
  83. package/dist/lib/core/types.d.ts +124 -0
  84. package/dist/lib/core/types.d.ts.map +1 -0
  85. package/dist/lib/core/types.js +6 -0
  86. package/dist/lib/core/types.js.map +1 -0
  87. package/dist/lib/project-generator.d.ts +15 -0
  88. package/dist/lib/project-generator.d.ts.map +1 -0
  89. package/dist/lib/project-generator.js +286 -0
  90. package/dist/lib/project-generator.js.map +1 -0
  91. package/dist/lib/push.d.ts +20 -0
  92. package/dist/lib/push.d.ts.map +1 -0
  93. package/dist/lib/push.js +222 -0
  94. package/dist/lib/push.js.map +1 -0
  95. package/dist/lib/react/builder.d.ts +45 -0
  96. package/dist/lib/react/builder.d.ts.map +1 -0
  97. package/dist/lib/react/builder.js +381 -0
  98. package/dist/lib/react/builder.js.map +1 -0
  99. package/dist/lib/react/bundler.d.ts +104 -0
  100. package/dist/lib/react/bundler.d.ts.map +1 -0
  101. package/dist/lib/react/bundler.js +654 -0
  102. package/dist/lib/react/bundler.js.map +1 -0
  103. package/dist/lib/react/config.d.ts +34 -0
  104. package/dist/lib/react/config.d.ts.map +1 -0
  105. package/dist/lib/react/config.js +64 -0
  106. package/dist/lib/react/config.js.map +1 -0
  107. package/dist/lib/react/import-map.d.ts +54 -0
  108. package/dist/lib/react/import-map.d.ts.map +1 -0
  109. package/dist/lib/react/import-map.js +187 -0
  110. package/dist/lib/react/import-map.js.map +1 -0
  111. package/dist/lib/shared/auth-middleware.d.ts +29 -0
  112. package/dist/lib/shared/auth-middleware.d.ts.map +1 -0
  113. package/dist/lib/shared/auth-middleware.js +48 -0
  114. package/dist/lib/shared/auth-middleware.js.map +1 -0
  115. package/dist/lib/shared/auth.d.ts +50 -0
  116. package/dist/lib/shared/auth.d.ts.map +1 -0
  117. package/dist/lib/shared/auth.js +243 -0
  118. package/dist/lib/shared/auth.js.map +1 -0
  119. package/dist/lib/shared/cdn-downloader.d.ts +30 -0
  120. package/dist/lib/shared/cdn-downloader.d.ts.map +1 -0
  121. package/dist/lib/shared/cdn-downloader.js +126 -0
  122. package/dist/lib/shared/cdn-downloader.js.map +1 -0
  123. package/dist/lib/shared/command-history.d.ts +29 -0
  124. package/dist/lib/shared/command-history.d.ts.map +1 -0
  125. package/dist/lib/shared/command-history.js +73 -0
  126. package/dist/lib/shared/command-history.js.map +1 -0
  127. package/dist/lib/shared/commands.d.ts +24 -0
  128. package/dist/lib/shared/commands.d.ts.map +1 -0
  129. package/dist/lib/shared/commands.js +63 -0
  130. package/dist/lib/shared/commands.js.map +1 -0
  131. package/dist/lib/shared/config.d.ts +40 -0
  132. package/dist/lib/shared/config.d.ts.map +1 -0
  133. package/dist/lib/shared/config.js +69 -0
  134. package/dist/lib/shared/config.js.map +1 -0
  135. package/dist/lib/shared/file-utils.d.ts +45 -0
  136. package/dist/lib/shared/file-utils.d.ts.map +1 -0
  137. package/dist/lib/shared/file-utils.js +88 -0
  138. package/dist/lib/shared/file-utils.js.map +1 -0
  139. package/dist/lib/shared/import-analyzer.d.ts +49 -0
  140. package/dist/lib/shared/import-analyzer.d.ts.map +1 -0
  141. package/dist/lib/shared/import-analyzer.js +268 -0
  142. package/dist/lib/shared/import-analyzer.js.map +1 -0
  143. package/dist/lib/shared/path-builder.d.ts +55 -0
  144. package/dist/lib/shared/path-builder.d.ts.map +1 -0
  145. package/dist/lib/shared/path-builder.js +66 -0
  146. package/dist/lib/shared/path-builder.js.map +1 -0
  147. package/dist/lib/shared/uploader.d.ts +79 -0
  148. package/dist/lib/shared/uploader.d.ts.map +1 -0
  149. package/dist/lib/shared/uploader.js +340 -0
  150. package/dist/lib/shared/uploader.js.map +1 -0
  151. package/dist/lib/shared/zip-creator.d.ts +18 -0
  152. package/dist/lib/shared/zip-creator.d.ts.map +1 -0
  153. package/dist/lib/shared/zip-creator.js +131 -0
  154. package/dist/lib/shared/zip-creator.js.map +1 -0
  155. package/dist/lib/svelte/builder.d.ts +37 -0
  156. package/dist/lib/svelte/builder.d.ts.map +1 -0
  157. package/dist/lib/svelte/builder.js +364 -0
  158. package/dist/lib/svelte/builder.js.map +1 -0
  159. package/dist/lib/svelte/bundler.d.ts +92 -0
  160. package/dist/lib/svelte/bundler.d.ts.map +1 -0
  161. package/dist/lib/svelte/bundler.js +499 -0
  162. package/dist/lib/svelte/bundler.js.map +1 -0
  163. package/dist/lib/svelte/config.d.ts +22 -0
  164. package/dist/lib/svelte/config.d.ts.map +1 -0
  165. package/dist/lib/svelte/config.js +65 -0
  166. package/dist/lib/svelte/config.js.map +1 -0
  167. package/dist/lib/svelte/import-map.d.ts +42 -0
  168. package/dist/lib/svelte/import-map.d.ts.map +1 -0
  169. package/dist/lib/svelte/import-map.js +197 -0
  170. package/dist/lib/svelte/import-map.js.map +1 -0
  171. package/dist/lib/template-manager.d.ts +33 -0
  172. package/dist/lib/template-manager.d.ts.map +1 -0
  173. package/dist/lib/template-manager.js +69 -0
  174. package/dist/lib/template-manager.js.map +1 -0
  175. package/dist/lib/validator.d.ts +10 -0
  176. package/dist/lib/validator.d.ts.map +1 -0
  177. package/dist/lib/validator.js +343 -0
  178. package/dist/lib/validator.js.map +1 -0
  179. package/dist/lib/vue/builder.d.ts +37 -0
  180. package/dist/lib/vue/builder.d.ts.map +1 -0
  181. package/dist/lib/vue/builder.js +366 -0
  182. package/dist/lib/vue/builder.js.map +1 -0
  183. package/dist/lib/vue/bundler.d.ts +78 -0
  184. package/dist/lib/vue/bundler.d.ts.map +1 -0
  185. package/dist/lib/vue/bundler.js +208 -0
  186. package/dist/lib/vue/bundler.js.map +1 -0
  187. package/dist/lib/vue/config.d.ts +18 -0
  188. package/dist/lib/vue/config.d.ts.map +1 -0
  189. package/dist/lib/vue/config.js +42 -0
  190. package/dist/lib/vue/config.js.map +1 -0
  191. package/dist/lib/vue/import-map.d.ts +42 -0
  192. package/dist/lib/vue/import-map.d.ts.map +1 -0
  193. package/dist/lib/vue/import-map.js +156 -0
  194. package/dist/lib/vue/import-map.js.map +1 -0
  195. package/dist/screens/BuildScreen.d.ts +8 -0
  196. package/dist/screens/BuildScreen.d.ts.map +1 -0
  197. package/dist/screens/BuildScreen.js +158 -0
  198. package/dist/screens/BuildScreen.js.map +1 -0
  199. package/dist/screens/CreateScreen.d.ts +12 -0
  200. package/dist/screens/CreateScreen.d.ts.map +1 -0
  201. package/dist/screens/CreateScreen.js +305 -0
  202. package/dist/screens/CreateScreen.js.map +1 -0
  203. package/dist/screens/InitScreen.d.ts +11 -0
  204. package/dist/screens/InitScreen.d.ts.map +1 -0
  205. package/dist/screens/InitScreen.js +339 -0
  206. package/dist/screens/InitScreen.js.map +1 -0
  207. package/dist/screens/LoginScreen.d.ts +15 -0
  208. package/dist/screens/LoginScreen.d.ts.map +1 -0
  209. package/dist/screens/LoginScreen.js +427 -0
  210. package/dist/screens/LoginScreen.js.map +1 -0
  211. package/dist/screens/LogoutScreen.d.ts +15 -0
  212. package/dist/screens/LogoutScreen.d.ts.map +1 -0
  213. package/dist/screens/LogoutScreen.js +187 -0
  214. package/dist/screens/LogoutScreen.js.map +1 -0
  215. package/dist/screens/PushScreen.d.ts +12 -0
  216. package/dist/screens/PushScreen.d.ts.map +1 -0
  217. package/dist/screens/PushScreen.js +546 -0
  218. package/dist/screens/PushScreen.js.map +1 -0
  219. package/dist/screens/ValidateScreen.d.ts +12 -0
  220. package/dist/screens/ValidateScreen.d.ts.map +1 -0
  221. package/dist/screens/ValidateScreen.js +193 -0
  222. package/dist/screens/ValidateScreen.js.map +1 -0
  223. package/dist/screens/WelcomeScreen.d.ts +39 -0
  224. package/dist/screens/WelcomeScreen.d.ts.map +1 -0
  225. package/dist/screens/WelcomeScreen.js +297 -0
  226. package/dist/screens/WelcomeScreen.js.map +1 -0
  227. package/dist/screens/WhoamiScreen.d.ts +14 -0
  228. package/dist/screens/WhoamiScreen.d.ts.map +1 -0
  229. package/dist/screens/WhoamiScreen.js +180 -0
  230. package/dist/screens/WhoamiScreen.js.map +1 -0
  231. package/dist/types/index.d.ts +40 -0
  232. package/dist/types/index.d.ts.map +1 -0
  233. package/dist/types/index.js +2 -0
  234. package/dist/types/index.js.map +1 -0
  235. package/dist/types/templates.d.ts +55 -0
  236. package/dist/types/templates.d.ts.map +1 -0
  237. package/dist/types/templates.js +6 -0
  238. package/dist/types/templates.js.map +1 -0
  239. package/dist/types/validation.d.ts +108 -0
  240. package/dist/types/validation.d.ts.map +1 -0
  241. package/dist/types/validation.js +6 -0
  242. package/dist/types/validation.js.map +1 -0
  243. package/package.json +94 -0
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Centralized Configuration Module
3
+ *
4
+ * Production defaults are baked in for end users (NPM and Homebrew).
5
+ * Contributors can override via environment variables or .env file.
6
+ *
7
+ * Compatible with:
8
+ * - NPM global install: npm install -g @oaysus/cli
9
+ * - Homebrew: brew install oaysus
10
+ * - Local development: bun run dev
11
+ */
12
+ /**
13
+ * Environment configuration
14
+ * Environment variables override production defaults for development
15
+ */
16
+ export declare const config: {
17
+ readonly SSO_BASE_URL: string;
18
+ readonly ADMIN_URL: string;
19
+ readonly R2_PUBLIC_URL: string;
20
+ readonly API_STAGE: string;
21
+ readonly DEVELOPER: string | undefined;
22
+ readonly DEBUG: boolean;
23
+ readonly CREDENTIALS_PATH: string;
24
+ readonly CONFIG_DIR: string;
25
+ };
26
+ export declare const SSO_BASE_URL: string, ADMIN_URL: string, R2_PUBLIC_URL: string, API_STAGE: string, DEVELOPER: string | undefined, DEBUG: boolean, CREDENTIALS_PATH: string, CONFIG_DIR: string;
27
+ /**
28
+ * Get current deployment environment
29
+ */
30
+ export type Environment = 'local' | 'dev' | 'prod';
31
+ export declare function getEnvironment(): Environment;
32
+ /**
33
+ * Debug logging helper
34
+ */
35
+ export declare function debug(...args: unknown[]): void;
36
+ /**
37
+ * Debug error logging helper
38
+ */
39
+ export declare function debugError(...args: unknown[]): void;
40
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;;;;;;CAwBT,CAAC;AAGX,eAAO,MACL,YAAY,UACZ,SAAS,UACT,aAAa,UACb,SAAS,UACT,SAAS,sBACT,KAAK,WACL,gBAAgB,UAChB,UAAU,QACF,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAEnD,wBAAgB,cAAc,IAAI,WAAW,CAS5C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAI9C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAInD"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Centralized Configuration Module
3
+ *
4
+ * Production defaults are baked in for end users (NPM and Homebrew).
5
+ * Contributors can override via environment variables or .env file.
6
+ *
7
+ * Compatible with:
8
+ * - NPM global install: npm install -g @oaysus/cli
9
+ * - Homebrew: brew install oaysus
10
+ * - Local development: bun run dev
11
+ */
12
+ import os from 'os';
13
+ import path from 'path';
14
+ // Production URLs (baked in for security)
15
+ const PROD_SSO_URL = 'https://auth.oaysus.com';
16
+ const PROD_ADMIN_URL = 'https://admin.oaysus.com';
17
+ const PROD_R2_URL = 'https://pub-71eb20e9b97849f18a95eaa92feb648a.r2.dev';
18
+ /**
19
+ * Environment configuration
20
+ * Environment variables override production defaults for development
21
+ */
22
+ export const config = {
23
+ // Authentication server URL
24
+ SSO_BASE_URL: process.env.NEXT_PUBLIC_OAYSUS_SSO_URL || PROD_SSO_URL,
25
+ // Admin dashboard URL (for magic link redirects)
26
+ ADMIN_URL: process.env.NEXT_PUBLIC_OAYSUS_ADMIN_URL || PROD_ADMIN_URL,
27
+ // R2 CDN URL for component hosting
28
+ R2_PUBLIC_URL: process.env.NEXT_PUBLIC_R2_PUBLIC_URL || PROD_R2_URL,
29
+ // Deployment environment: 'prod' | 'dev' | 'local'
30
+ API_STAGE: process.env.NEXT_PUBLIC_API_STAGE || (process.env.NODE_ENV === 'production' ? 'prod' : 'prod'),
31
+ // Developer namespace for local testing (contributors only)
32
+ DEVELOPER: process.env.DEVELOPER,
33
+ // Debug mode (console logging, off by default)
34
+ DEBUG: process.env.DEBUG === 'true',
35
+ // Credentials storage path (works for both NPM and Homebrew)
36
+ CREDENTIALS_PATH: path.join(os.homedir(), '.oaysus', 'credentials.json'),
37
+ // Config directory
38
+ CONFIG_DIR: path.join(os.homedir(), '.oaysus'),
39
+ };
40
+ // Export individual values for convenience
41
+ export const { SSO_BASE_URL, ADMIN_URL, R2_PUBLIC_URL, API_STAGE, DEVELOPER, DEBUG, CREDENTIALS_PATH, CONFIG_DIR, } = config;
42
+ export function getEnvironment() {
43
+ const stage = config.API_STAGE;
44
+ if (stage === 'local')
45
+ return 'local';
46
+ if (stage === 'dev')
47
+ return 'dev';
48
+ if (stage === 'prod' || stage === 'production')
49
+ return 'prod';
50
+ // Default to prod for published CLI
51
+ return 'prod';
52
+ }
53
+ /**
54
+ * Debug logging helper
55
+ */
56
+ export function debug(...args) {
57
+ if (config.DEBUG) {
58
+ console.log('[DEBUG]', ...args);
59
+ }
60
+ }
61
+ /**
62
+ * Debug error logging helper
63
+ */
64
+ export function debugError(...args) {
65
+ if (config.DEBUG) {
66
+ console.error('[ERROR]', ...args);
67
+ }
68
+ }
69
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/lib/shared/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,0CAA0C;AAC1C,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAC/C,MAAM,cAAc,GAAG,0BAA0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KAAK,MAAM,IAAI,KAAK,KAAK,YAAY;QAAE,OAAO,MAAM,CAAC;IAE9D,oCAAoC;IACpC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,KAAK,CAAC,GAAG,IAAe;IACtC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;IAClC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,GAAG,IAAe;IAC3C,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,CAAC;IACpC,CAAC;AACH,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * File System Utilities
3
+ * Helper functions for file and directory operations
4
+ */
5
+ /**
6
+ * Check if a directory exists
7
+ */
8
+ export declare function directoryExists(dirPath: string): boolean;
9
+ /**
10
+ * Check if a file exists
11
+ */
12
+ export declare function fileExists(filePath: string): boolean;
13
+ /**
14
+ * Create a directory recursively
15
+ */
16
+ export declare function createDirectory(dirPath: string): void;
17
+ /**
18
+ * Write content to a file, creating directories as needed
19
+ */
20
+ export declare function writeFile(filePath: string, content: string): void;
21
+ /**
22
+ * Read file content
23
+ */
24
+ export declare function readFile(filePath: string): string;
25
+ /**
26
+ * Copy file from source to destination
27
+ */
28
+ export declare function copyFile(sourcePath: string, destPath: string): void;
29
+ /**
30
+ * Validate project name (lowercase, hyphens only)
31
+ */
32
+ export declare function isValidProjectName(name: string): boolean;
33
+ /**
34
+ * Convert a string to kebab-case
35
+ */
36
+ export declare function toKebabCase(str: string): string;
37
+ /**
38
+ * Convert a string to PascalCase
39
+ */
40
+ export declare function toPascalCase(str: string): string;
41
+ /**
42
+ * Get the current year
43
+ */
44
+ export declare function getCurrentYear(): number;
45
+ //# sourceMappingURL=file-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-utils.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/file-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAMxD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAMpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIjE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGnE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * File System Utilities
3
+ * Helper functions for file and directory operations
4
+ */
5
+ import fs from 'fs';
6
+ import path from 'path';
7
+ /**
8
+ * Check if a directory exists
9
+ */
10
+ export function directoryExists(dirPath) {
11
+ try {
12
+ return fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory();
13
+ }
14
+ catch {
15
+ return false;
16
+ }
17
+ }
18
+ /**
19
+ * Check if a file exists
20
+ */
21
+ export function fileExists(filePath) {
22
+ try {
23
+ return fs.existsSync(filePath) && fs.statSync(filePath).isFile();
24
+ }
25
+ catch {
26
+ return false;
27
+ }
28
+ }
29
+ /**
30
+ * Create a directory recursively
31
+ */
32
+ export function createDirectory(dirPath) {
33
+ if (!directoryExists(dirPath)) {
34
+ fs.mkdirSync(dirPath, { recursive: true });
35
+ }
36
+ }
37
+ /**
38
+ * Write content to a file, creating directories as needed
39
+ */
40
+ export function writeFile(filePath, content) {
41
+ const dir = path.dirname(filePath);
42
+ createDirectory(dir);
43
+ fs.writeFileSync(filePath, content, 'utf-8');
44
+ }
45
+ /**
46
+ * Read file content
47
+ */
48
+ export function readFile(filePath) {
49
+ return fs.readFileSync(filePath, 'utf-8');
50
+ }
51
+ /**
52
+ * Copy file from source to destination
53
+ */
54
+ export function copyFile(sourcePath, destPath) {
55
+ const content = readFile(sourcePath);
56
+ writeFile(destPath, content);
57
+ }
58
+ /**
59
+ * Validate project name (lowercase, hyphens only)
60
+ */
61
+ export function isValidProjectName(name) {
62
+ return /^[a-z0-9-]+$/.test(name);
63
+ }
64
+ /**
65
+ * Convert a string to kebab-case
66
+ */
67
+ export function toKebabCase(str) {
68
+ return str
69
+ .toLowerCase()
70
+ .replace(/[^a-z0-9]+/g, '-')
71
+ .replace(/^-+|-+$/g, '');
72
+ }
73
+ /**
74
+ * Convert a string to PascalCase
75
+ */
76
+ export function toPascalCase(str) {
77
+ return str
78
+ .split(/[-_\s]+/)
79
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
80
+ .join('');
81
+ }
82
+ /**
83
+ * Get the current year
84
+ */
85
+ export function getCurrentYear() {
86
+ return new Date().getFullYear();
87
+ }
88
+ //# sourceMappingURL=file-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-utils.js","sourceRoot":"","sources":["../../../src/lib/shared/file-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;GAEG;AACH,MAAM,UAAU,eAAe,C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AAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG;SACP,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,GAAG;SACP,KAAK,CAAC,SAAS,CAAC;SAChB,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;SACvE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Import Analyzer
3
+ * Scans component source files to detect external dependencies
4
+ * Used to determine which packages need to be bundled separately
5
+ */
6
+ /**
7
+ * Detected dependency with all its imports
8
+ */
9
+ export interface DetectedDependency {
10
+ /** Package name (e.g., "swiper") */
11
+ name: string;
12
+ /** Version from package.json */
13
+ version: string;
14
+ /** All import specifiers found (e.g., ["swiper", "swiper/react"]) */
15
+ imports: string[];
16
+ /** Sub-exports to bundle (e.g., ["react", "modules"]) */
17
+ subExports: string[];
18
+ /** Whether any CSS imports were detected */
19
+ hasCSS: boolean;
20
+ /** CSS import specifiers (e.g., ["swiper/css", "swiper/css/navigation"]) */
21
+ cssImports: string[];
22
+ }
23
+ /**
24
+ * Analyze component files and detect external dependencies
25
+ *
26
+ * @param componentPaths - Absolute paths to component entry files
27
+ * @param packageJson - Package.json contents
28
+ * @returns Array of detected dependencies with their imports
29
+ */
30
+ export declare function analyzeComponentImports(componentPaths: string[], packageJson: any): DetectedDependency[];
31
+ /**
32
+ * Merge detected dependencies with existing dependencies list
33
+ * Used to combine framework deps (React) with detected deps (Swiper)
34
+ */
35
+ export declare function mergeWithFrameworkDeps(frameworkDeps: Array<{
36
+ name: string;
37
+ version: string;
38
+ }>, detectedDeps: DetectedDependency[]): Array<{
39
+ name: string;
40
+ version: string;
41
+ subExports?: string[];
42
+ cssImports?: string[];
43
+ }>;
44
+ declare const _default: {
45
+ analyzeComponentImports: typeof analyzeComponentImports;
46
+ mergeWithFrameworkDeps: typeof mergeWithFrameworkDeps;
47
+ };
48
+ export default _default;
49
+ //# sourceMappingURL=import-analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-analyzer.d.ts","sourceRoot":"","sources":["../../../src/lib/shared/import-analyzer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,yDAAyD;IACzD,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,4CAA4C;IAC5C,MAAM,EAAE,OAAO,CAAC;IAChB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAqJD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,MAAM,EAAE,EACxB,WAAW,EAAE,GAAG,GACf,kBAAkB,EAAE,CA6GtB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EACvD,YAAY,EAAE,kBAAkB,EAAE,GACjC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAmBxF;;;;;AAED,wBAGE"}
@@ -0,0 +1,268 @@
1
+ /**
2
+ * Import Analyzer
3
+ * Scans component source files to detect external dependencies
4
+ * Used to determine which packages need to be bundled separately
5
+ */
6
+ import fs from 'fs';
7
+ import path from 'path';
8
+ /**
9
+ * Packages that are always externalized (framework deps)
10
+ */
11
+ const FRAMEWORK_EXTERNALS = [
12
+ 'react',
13
+ 'react-dom',
14
+ 'vue',
15
+ 'svelte',
16
+ 'solid-js'
17
+ ];
18
+ /**
19
+ * Dev-only packages that should never be bundled
20
+ */
21
+ const DEV_ONLY_PATTERNS = [
22
+ /^@types\//,
23
+ /^typescript$/,
24
+ /^eslint/,
25
+ /^prettier/,
26
+ /^vite$/,
27
+ /^vitest/,
28
+ /^jest/,
29
+ /^@testing-library/,
30
+ /^autoprefixer$/,
31
+ /^postcss$/,
32
+ /^tailwindcss$/,
33
+ /^@tailwindcss\//,
34
+ /^@vitejs\//,
35
+ /^@storybook\//,
36
+ /^storybook$/
37
+ ];
38
+ /**
39
+ * Extract all import statements from source code
40
+ * Handles both static imports and dynamic imports
41
+ */
42
+ function extractImports(sourceCode) {
43
+ const imports = [];
44
+ // Match static imports: import ... from "package"
45
+ const staticImportRegex = /import\s+(?:(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)\s*,?\s*)*\s*from\s*['"]([^'"]+)['"]/g;
46
+ let match;
47
+ while ((match = staticImportRegex.exec(sourceCode)) !== null) {
48
+ imports.push(match[1]);
49
+ }
50
+ // Match side-effect imports: import "package"
51
+ const sideEffectImportRegex = /import\s+['"]([^'"]+)['"]/g;
52
+ while ((match = sideEffectImportRegex.exec(sourceCode)) !== null) {
53
+ imports.push(match[1]);
54
+ }
55
+ // Match dynamic imports: import("package")
56
+ const dynamicImportRegex = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
57
+ while ((match = dynamicImportRegex.exec(sourceCode)) !== null) {
58
+ imports.push(match[1]);
59
+ }
60
+ // Match require statements: require("package")
61
+ const requireRegex = /require\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
62
+ while ((match = requireRegex.exec(sourceCode)) !== null) {
63
+ imports.push(match[1]);
64
+ }
65
+ return imports;
66
+ }
67
+ /**
68
+ * Check if an import is external (not relative or absolute path)
69
+ */
70
+ function isExternalImport(importPath) {
71
+ // Relative imports start with . or ..
72
+ if (importPath.startsWith('.') || importPath.startsWith('/')) {
73
+ return false;
74
+ }
75
+ // Node built-ins
76
+ if (importPath.startsWith('node:')) {
77
+ return false;
78
+ }
79
+ return true;
80
+ }
81
+ /**
82
+ * Get the package name from an import specifier
83
+ * e.g., "swiper/react" -> "swiper"
84
+ * e.g., "@scope/package/sub" -> "@scope/package"
85
+ */
86
+ function getPackageName(importPath) {
87
+ if (importPath.startsWith('@')) {
88
+ // Scoped package: @scope/package/sub -> @scope/package
89
+ const parts = importPath.split('/');
90
+ return parts.slice(0, 2).join('/');
91
+ }
92
+ // Regular package: package/sub -> package
93
+ return importPath.split('/')[0];
94
+ }
95
+ /**
96
+ * Get the sub-export path from an import specifier
97
+ * e.g., "swiper/react" -> "react"
98
+ * e.g., "@scope/package/sub/path" -> "sub/path"
99
+ */
100
+ function getSubExport(importPath) {
101
+ const packageName = getPackageName(importPath);
102
+ if (importPath === packageName) {
103
+ return null; // Main export
104
+ }
105
+ return importPath.slice(packageName.length + 1); // Remove package name and /
106
+ }
107
+ /**
108
+ * Check if an import is a CSS import
109
+ */
110
+ function isCSSImport(importPath) {
111
+ // Direct .css extension
112
+ if (importPath.endsWith('.css')) {
113
+ return true;
114
+ }
115
+ // Known CSS-exporting paths (like swiper/css)
116
+ const cssPatterns = [
117
+ /\/css$/,
118
+ /\/css\//,
119
+ /\/styles$/,
120
+ /\/styles\//,
121
+ /\.scss$/,
122
+ /\.less$/,
123
+ /\.sass$/
124
+ ];
125
+ return cssPatterns.some(pattern => pattern.test(importPath));
126
+ }
127
+ /**
128
+ * Check if a package is dev-only
129
+ */
130
+ function isDevOnlyPackage(packageName) {
131
+ return DEV_ONLY_PATTERNS.some(pattern => pattern.test(packageName));
132
+ }
133
+ /**
134
+ * Check if a package is a framework external
135
+ */
136
+ function isFrameworkExternal(packageName) {
137
+ return FRAMEWORK_EXTERNALS.some(ext => packageName === ext || packageName.startsWith(ext + '/'));
138
+ }
139
+ /**
140
+ * Analyze component files and detect external dependencies
141
+ *
142
+ * @param componentPaths - Absolute paths to component entry files
143
+ * @param packageJson - Package.json contents
144
+ * @returns Array of detected dependencies with their imports
145
+ */
146
+ export function analyzeComponentImports(componentPaths, packageJson) {
147
+ console.log('[ImportAnalyzer] Starting analysis of', componentPaths.length, 'components');
148
+ const allImports = new Map(); // packageName -> Set of full import paths
149
+ // Get all dependencies from package.json
150
+ const deps = {
151
+ ...packageJson.dependencies,
152
+ ...packageJson.peerDependencies
153
+ };
154
+ console.log('[ImportAnalyzer] Package deps:', Object.keys(deps || {}).slice(0, 10).join(', '));
155
+ // Read and analyze each component file
156
+ for (const componentPath of componentPaths) {
157
+ try {
158
+ // Also analyze any local imports recursively (limited depth)
159
+ const filesToAnalyze = [componentPath];
160
+ const analyzed = new Set();
161
+ const componentDir = path.dirname(componentPath);
162
+ while (filesToAnalyze.length > 0) {
163
+ const filePath = filesToAnalyze.pop();
164
+ if (analyzed.has(filePath))
165
+ continue;
166
+ analyzed.add(filePath);
167
+ // Try to read the file (handle .tsx, .ts, .jsx, .js)
168
+ let sourceCode = '';
169
+ const extensions = ['', '.tsx', '.ts', '.jsx', '.js'];
170
+ for (const ext of extensions) {
171
+ const tryPath = filePath + ext;
172
+ if (fs.existsSync(tryPath)) {
173
+ sourceCode = fs.readFileSync(tryPath, 'utf-8');
174
+ break;
175
+ }
176
+ }
177
+ if (!sourceCode && fs.existsSync(filePath)) {
178
+ sourceCode = fs.readFileSync(filePath, 'utf-8');
179
+ }
180
+ if (!sourceCode)
181
+ continue;
182
+ // Extract imports
183
+ const imports = extractImports(sourceCode);
184
+ for (const importPath of imports) {
185
+ if (isExternalImport(importPath)) {
186
+ const packageName = getPackageName(importPath);
187
+ // Only track if it's in our dependencies
188
+ if (deps[packageName]) {
189
+ if (!allImports.has(packageName)) {
190
+ allImports.set(packageName, new Set());
191
+ }
192
+ allImports.get(packageName).add(importPath);
193
+ }
194
+ }
195
+ else if (importPath.startsWith('.')) {
196
+ // Local import - add to analyze queue (limited to same component)
197
+ const resolvedPath = path.resolve(path.dirname(filePath), importPath);
198
+ // Only follow if within the component directory
199
+ if (resolvedPath.startsWith(componentDir) && analyzed.size < 50) {
200
+ filesToAnalyze.push(resolvedPath);
201
+ }
202
+ }
203
+ }
204
+ }
205
+ }
206
+ catch (error) {
207
+ console.warn(`[ImportAnalyzer] Could not analyze ${componentPath}:`, error);
208
+ }
209
+ }
210
+ console.log('[ImportAnalyzer] External packages found:', Array.from(allImports.keys()).join(', ') || 'none');
211
+ // Convert to DetectedDependency array
212
+ const detected = [];
213
+ for (const [packageName, importPaths] of allImports) {
214
+ // Skip framework externals and dev-only packages
215
+ if (isFrameworkExternal(packageName) || isDevOnlyPackage(packageName)) {
216
+ continue;
217
+ }
218
+ // Get version from package.json
219
+ const version = (deps[packageName] || '0.0.0').replace(/^[\^~>=<]/, '');
220
+ // Categorize imports
221
+ const imports = Array.from(importPaths);
222
+ const cssImports = imports.filter(isCSSImport);
223
+ const jsImports = imports.filter(imp => !isCSSImport(imp));
224
+ // Extract sub-exports
225
+ const subExports = new Set();
226
+ for (const imp of jsImports) {
227
+ const sub = getSubExport(imp);
228
+ if (sub) {
229
+ subExports.add(sub);
230
+ }
231
+ }
232
+ detected.push({
233
+ name: packageName,
234
+ version,
235
+ imports,
236
+ subExports: Array.from(subExports),
237
+ hasCSS: cssImports.length > 0,
238
+ cssImports
239
+ });
240
+ }
241
+ return detected;
242
+ }
243
+ /**
244
+ * Merge detected dependencies with existing dependencies list
245
+ * Used to combine framework deps (React) with detected deps (Swiper)
246
+ */
247
+ export function mergeWithFrameworkDeps(frameworkDeps, detectedDeps) {
248
+ const result = [];
249
+ // Add framework deps first
250
+ for (const dep of frameworkDeps) {
251
+ result.push({ name: dep.name, version: dep.version });
252
+ }
253
+ // Add detected deps
254
+ for (const dep of detectedDeps) {
255
+ result.push({
256
+ name: dep.name,
257
+ version: dep.version,
258
+ subExports: dep.subExports.length > 0 ? dep.subExports : undefined,
259
+ cssImports: dep.cssImports.length > 0 ? dep.cssImports : undefined
260
+ });
261
+ }
262
+ return result;
263
+ }
264
+ export default {
265
+ analyzeComponentImports,
266
+ mergeWithFrameworkDeps
267
+ };
268
+ //# sourceMappingURL=import-analyzer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-analyzer.js","sourceRoot":"","sources":["../../../src/lib/shared/import-analyzer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAoBxB;;GAEG;AACH,MAAM,mBAAmB,GAAG;IAC1B,OAAO;IACP,WAAW;IACX,KAAK;IACL,QAAQ;IACR,UAAU;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACxB,WAAW;IACX,cAAc;IACd,SAAS;IACT,WAAW;IACX,QAAQ;IACR,SAAS;IACT,OAAO;IACP,mBAAmB;IACnB,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,iBAAiB;IACjB,YAAY;IACZ,eAAe;IACf,aAAa;CACd,CAAC;AAEF;;;GAGG;AACH,SAAS,cAAc,CAAC,UAAkB;IACxC,MAAM,OAAO,GAAa,EAAE,CAAC;IAE7B,kDAAkD;IAClD,MAAM,iBAAiB,GAAG,kFAAkF,CAAC;IAC7G,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KA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AC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;SACnE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,eAAe;IACb,uBAAuB;IACvB,sBAAsB;CACvB,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * R2 Path Builder
3
+ * Constructs environment-aware R2 paths for component theme uploads
4
+ */
5
+ import type { PackageJson } from '../../types/validation.js';
6
+ import type { Credentials } from '../../types/index.js';
7
+ export type { Environment } from './config.js';
8
+ /**
9
+ * Metadata for upload paths and tracking
10
+ */
11
+ export interface UploadMetadata {
12
+ environment: 'local' | 'dev' | 'prod';
13
+ developer?: string;
14
+ websiteId: string;
15
+ themeName: string;
16
+ displayName: string;
17
+ version: string;
18
+ r2Path: string;
19
+ importMap?: Record<string, any>;
20
+ stylesheets?: Record<string, string>;
21
+ dependencies?: Array<{
22
+ name: string;
23
+ version: string;
24
+ }>;
25
+ }
26
+ /**
27
+ * Build R2 base path for component theme upload
28
+ *
29
+ * Path structure (base path without filename):
30
+ * - Local: local/{developer}/{websiteId}/{themeName}/{version}
31
+ * - Dev: dev/{websiteId}/{themeName}/{version}
32
+ * - Prod: prod/{websiteId}/{themeName}/{version}
33
+ *
34
+ * Build files are appended to this base path:
35
+ * - {basePath}/index.js
36
+ * - {basePath}/index.css
37
+ * - {basePath}/metadata.json
38
+ */
39
+ export declare function buildR2Path(packageJson: PackageJson, credentials: Credentials): string;
40
+ /**
41
+ * Build complete upload metadata
42
+ */
43
+ export declare function buildUploadMetadata(packageJson: PackageJson, credentials: Credentials, options?: {
44
+ importMap?: Record<string, any>;
45
+ stylesheets?: Record<string, string>;
46
+ dependencies?: Array<{
47
+ name: string;
48
+ version: string;
49
+ }>;
50
+ }): UploadMetadata;
51
+ /**
52
+ * Get base path for theme (without version)
53
+ */
54
+ export declare function getThemeBasePath(packageJson: PackageJson, credentials: Credentials): string;
55
+ //# sourceMappingURL=path-builder.d.ts.map
@@ -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