@ohos-ports/yext-pages 0.0.0-stage → 1.3.4-beta.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 (346) hide show
  1. package/LICENSE +32 -0
  2. package/README.md +125 -2
  3. package/THIRD-PARTY-NOTICES +1203 -0
  4. package/dist/bin/loader.js +9 -0
  5. package/dist/bin/pages.js +26 -0
  6. package/dist/bin/spawn.js +30 -0
  7. package/dist/build/build.js +33 -0
  8. package/dist/bundler.js +53 -0
  9. package/dist/common/src/artifacts/internal/types.js +0 -0
  10. package/dist/common/src/assets/getAssetsFilepath.js +12 -0
  11. package/dist/common/src/assets/getPublicFilepath.js +12 -0
  12. package/dist/common/src/assets/import.js +14 -0
  13. package/dist/common/src/ci/ci.js +0 -0
  14. package/dist/common/src/config/types.js +0 -0
  15. package/dist/common/src/feature/features.js +53 -0
  16. package/dist/common/src/feature/stream.js +106 -0
  17. package/dist/common/src/function/internal/functionMetadataParser.js +72 -0
  18. package/dist/common/src/function/internal/getFunctionFilepaths.js +18 -0
  19. package/dist/common/src/function/internal/loader.js +48 -0
  20. package/dist/common/src/function/internal/types.js +44 -0
  21. package/dist/common/src/function/internal/validateFunctionModule.js +8 -0
  22. package/dist/common/src/function/types.js +0 -0
  23. package/dist/common/src/loader/vite.js +65 -0
  24. package/dist/common/src/module/hydration.js +36 -0
  25. package/dist/common/src/module/internal/_client.js +9 -0
  26. package/dist/common/src/module/internal/_client17.js +9 -0
  27. package/dist/common/src/module/internal/_server.js +19 -0
  28. package/dist/common/src/module/internal/getModuleConfig.js +10 -0
  29. package/dist/common/src/module/internal/getModuleFilepaths.js +58 -0
  30. package/dist/common/src/module/internal/logger.js +25 -0
  31. package/dist/common/src/module/internal/types.js +27 -0
  32. package/dist/common/src/module/internal/validateModuleInternal.js +10 -0
  33. package/dist/common/src/module/types.js +0 -0
  34. package/dist/common/src/parsers/puckConfigParser.js +31 -0
  35. package/dist/common/src/parsers/sourceFileParser.js +269 -0
  36. package/dist/common/src/parsers/tailwindConfigParser.js +77 -0
  37. package/dist/common/src/parsers/templateParser.js +52 -0
  38. package/dist/common/src/project/path.js +16 -0
  39. package/dist/common/src/project/structure.js +197 -0
  40. package/dist/common/src/redirect/internal/getRedirectFilepaths.js +27 -0
  41. package/dist/common/src/redirect/internal/types.js +32 -0
  42. package/dist/common/src/redirect/internal/validateRedirectModuleInternal.js +29 -0
  43. package/dist/common/src/redirect/loader/loader.js +34 -0
  44. package/dist/common/src/redirect/types.js +0 -0
  45. package/dist/common/src/template/client.js +28 -0
  46. package/dist/common/src/template/head.js +50 -0
  47. package/dist/common/src/template/hydration.js +127 -0
  48. package/dist/common/src/template/internal/_client.js +12 -0
  49. package/dist/common/src/template/internal/_client17.js +12 -0
  50. package/dist/common/src/template/internal/_server.js +23 -0
  51. package/dist/common/src/template/internal/getTemplateFilepaths.js +67 -0
  52. package/dist/common/src/template/internal/resolveTemplateName.js +36 -0
  53. package/dist/common/src/template/internal/types.js +62 -0
  54. package/dist/common/src/template/internal/util.js +11 -0
  55. package/dist/common/src/template/internal/validateGetPathValue.js +10 -0
  56. package/dist/common/src/template/internal/validateTemplateModuleInternal.js +29 -0
  57. package/dist/common/src/template/loader/loader.js +54 -0
  58. package/dist/common/src/template/paths.js +13 -0
  59. package/dist/common/src/template/types.js +0 -0
  60. package/dist/dev/dev.js +53 -0
  61. package/dist/dev/server/autoInit.js +119 -0
  62. package/dist/dev/server/middleware/constants.js +53 -0
  63. package/dist/dev/server/middleware/errorMiddleware.js +37 -0
  64. package/dist/dev/server/middleware/finalSlashRedirect.js +12 -0
  65. package/dist/dev/server/middleware/getContentType.js +9 -0
  66. package/dist/dev/server/middleware/ignoreFavicon.js +10 -0
  67. package/dist/dev/server/middleware/indexPage.js +352 -0
  68. package/dist/dev/server/middleware/send404.js +9 -0
  69. package/dist/dev/server/middleware/sendAppHTML.js +71 -0
  70. package/dist/dev/server/middleware/serveHttpFunction.js +49 -0
  71. package/dist/dev/server/middleware/serveModule.js +40 -0
  72. package/dist/dev/server/middleware/serverRenderModule.js +19 -0
  73. package/dist/dev/server/middleware/serverRenderRoute.js +146 -0
  74. package/dist/dev/server/middleware/serverRenderSlugRoute.js +113 -0
  75. package/dist/dev/server/public/404.js +4 -0
  76. package/dist/dev/server/public/500.js +4 -0
  77. package/dist/dev/server/public/favicon.ico +0 -0
  78. package/dist/dev/server/public/index.js +4 -0
  79. package/dist/dev/server/public/public.d.js +0 -0
  80. package/dist/dev/server/server.js +218 -0
  81. package/dist/dev/server/ssr/constants.js +16 -0
  82. package/dist/dev/server/ssr/findMatchingModule.js +65 -0
  83. package/dist/dev/server/ssr/findMatchingStaticTemplate.js +87 -0
  84. package/dist/dev/server/ssr/findTemplateModuleInternal.js +43 -0
  85. package/dist/dev/server/ssr/generateTestData.js +232 -0
  86. package/dist/dev/server/ssr/getLocalData.js +194 -0
  87. package/dist/dev/server/ssr/getPluginFileMap.js +24 -0
  88. package/dist/dev/server/ssr/inPlatformPageSets.js +91 -0
  89. package/dist/dev/server/ssr/loadViteModule.js +7 -0
  90. package/dist/dev/server/ssr/moduleImports.js +9 -0
  91. package/dist/dev/server/ssr/parseNonProdUrl.js +22 -0
  92. package/dist/dev/server/ssr/propsLoader.js +29 -0
  93. package/dist/dev/server/ssr/types.js +0 -0
  94. package/dist/generate/artifacts/artifacts.js +21 -0
  95. package/dist/generate/artifacts/createArtifactsJson.js +100 -0
  96. package/dist/generate/ci/ci.js +140 -0
  97. package/dist/generate/features/features.js +17 -0
  98. package/dist/generate/generate.js +16 -0
  99. package/dist/generate/templates/createTemplatesJson.js +160 -0
  100. package/dist/generate/templates/templates.js +18 -0
  101. package/dist/index.js +11 -0
  102. package/dist/plugin/manifest.ts +135 -0
  103. package/dist/plugin/mod.ts +29 -0
  104. package/dist/plugins/index.js +4 -0
  105. package/dist/plugins/onUrlChange/urlWriteback.js +24 -0
  106. package/dist/plugins/onUrlChange/yext.js +33 -0
  107. package/dist/prod/prod.js +17 -0
  108. package/dist/scaffold/modules/generate.js +128 -0
  109. package/dist/scaffold/modules/modules.js +21 -0
  110. package/dist/scaffold/modules/templates.js +92 -0
  111. package/dist/scaffold/scaffold.js +17 -0
  112. package/dist/scaffold/template/generate.js +224 -0
  113. package/dist/scaffold/template/sampleTemplates.js +608 -0
  114. package/dist/scaffold/template/template.js +21 -0
  115. package/dist/types/src/bin/loader.d.ts +1 -0
  116. package/dist/types/src/bin/pages.d.ts +1 -0
  117. package/dist/types/src/bin/spawn.d.ts +2 -0
  118. package/dist/types/src/build/build.d.ts +12 -0
  119. package/dist/types/src/common/src/artifacts/internal/types.d.ts +53 -0
  120. package/dist/types/src/common/src/assets/getAssetsFilepath.d.ts +7 -0
  121. package/dist/types/src/common/src/assets/getAssetsFilepath.test.d.ts +1 -0
  122. package/dist/types/src/common/src/assets/getPublicFilepath.d.ts +6 -0
  123. package/dist/types/src/common/src/assets/getPublicFilepath.test.d.ts +1 -0
  124. package/dist/types/src/common/src/assets/import.d.ts +8 -0
  125. package/dist/types/src/common/src/assets/import.test.d.ts +1 -0
  126. package/dist/types/src/common/src/ci/ci.d.ts +86 -0
  127. package/dist/types/src/common/src/config/types.d.ts +65 -0
  128. package/dist/types/src/common/src/feature/features.d.ts +60 -0
  129. package/dist/types/src/common/src/feature/features.test.d.ts +1 -0
  130. package/dist/types/src/common/src/feature/stream.d.ts +88 -0
  131. package/dist/types/src/common/src/feature/stream.test.d.ts +1 -0
  132. package/dist/types/src/common/src/function/internal/functionMetadataParser.d.ts +20 -0
  133. package/dist/types/src/common/src/function/internal/getFunctionFilepaths.d.ts +7 -0
  134. package/dist/types/src/common/src/function/internal/getFunctionFilepaths.test.d.ts +1 -0
  135. package/dist/types/src/common/src/function/internal/loader.d.ts +22 -0
  136. package/dist/types/src/common/src/function/internal/loader.test.d.ts +1 -0
  137. package/dist/types/src/common/src/function/internal/types.d.ts +43 -0
  138. package/dist/types/src/common/src/function/internal/types.test.d.ts +1 -0
  139. package/dist/types/src/common/src/function/internal/validateFunctionModule.d.ts +2 -0
  140. package/dist/types/src/common/src/function/internal/validateFunctionModule.test.d.ts +1 -0
  141. package/dist/types/src/common/src/function/types.d.ts +148 -0
  142. package/dist/types/src/common/src/loader/vite.d.ts +15 -0
  143. package/dist/types/src/common/src/module/hydration.d.ts +9 -0
  144. package/dist/types/src/common/src/module/internal/_client.d.ts +3 -0
  145. package/dist/types/src/common/src/module/internal/_client17.d.ts +3 -0
  146. package/dist/types/src/common/src/module/internal/_server.d.ts +4 -0
  147. package/dist/types/src/common/src/module/internal/getModuleConfig.d.ts +5 -0
  148. package/dist/types/src/common/src/module/internal/getModuleFilepaths.d.ts +16 -0
  149. package/dist/types/src/common/src/module/internal/logger.d.ts +6 -0
  150. package/dist/types/src/common/src/module/internal/types.d.ts +29 -0
  151. package/dist/types/src/common/src/module/internal/validateModuleInternal.d.ts +2 -0
  152. package/dist/types/src/common/src/module/types.d.ts +82 -0
  153. package/dist/types/src/common/src/parsers/puckConfigParser.d.ts +7 -0
  154. package/dist/types/src/common/src/parsers/puckConfigParser.test.d.ts +1 -0
  155. package/dist/types/src/common/src/parsers/sourceFileParser.d.ts +82 -0
  156. package/dist/types/src/common/src/parsers/sourceFileParser.test.d.ts +1 -0
  157. package/dist/types/src/common/src/parsers/tailwindConfigParser.d.ts +5 -0
  158. package/dist/types/src/common/src/parsers/tailwindConfigParser.test.d.ts +1 -0
  159. package/dist/types/src/common/src/parsers/templateParser.d.ts +29 -0
  160. package/dist/types/src/common/src/parsers/templateParser.test.d.ts +1 -0
  161. package/dist/types/src/common/src/project/path.d.ts +11 -0
  162. package/dist/types/src/common/src/project/structure.d.ts +190 -0
  163. package/dist/types/src/common/src/project/structure.test.d.ts +1 -0
  164. package/dist/types/src/common/src/redirect/internal/getRedirectFilepaths.d.ts +14 -0
  165. package/dist/types/src/common/src/redirect/internal/types.d.ts +37 -0
  166. package/dist/types/src/common/src/redirect/internal/validateRedirectModuleInternal.d.ts +3 -0
  167. package/dist/types/src/common/src/redirect/loader/loader.d.ts +13 -0
  168. package/dist/types/src/common/src/redirect/types.d.ts +54 -0
  169. package/dist/types/src/common/src/template/client.d.ts +5 -0
  170. package/dist/types/src/common/src/template/head.d.ts +71 -0
  171. package/dist/types/src/common/src/template/head.test.d.ts +1 -0
  172. package/dist/types/src/common/src/template/hydration.d.ts +70 -0
  173. package/dist/types/src/common/src/template/internal/_client.d.ts +3 -0
  174. package/dist/types/src/common/src/template/internal/_client17.d.ts +3 -0
  175. package/dist/types/src/common/src/template/internal/_server.d.ts +4 -0
  176. package/dist/types/src/common/src/template/internal/getTemplateFilepaths.d.ts +26 -0
  177. package/dist/types/src/common/src/template/internal/getTemplateFilepaths.test.d.ts +1 -0
  178. package/dist/types/src/common/src/template/internal/resolveTemplateName.d.ts +3 -0
  179. package/dist/types/src/common/src/template/internal/resolveTemplateName.test.d.ts +1 -0
  180. package/dist/types/src/common/src/template/internal/types.d.ts +111 -0
  181. package/dist/types/src/common/src/template/internal/types.test.d.ts +1 -0
  182. package/dist/types/src/common/src/template/internal/util.d.ts +3 -0
  183. package/dist/types/src/common/src/template/internal/validateGetPathValue.d.ts +1 -0
  184. package/dist/types/src/common/src/template/internal/validateTemplateModuleInternal.d.ts +3 -0
  185. package/dist/types/src/common/src/template/internal/validateTemplateModuleInternal.test.d.ts +1 -0
  186. package/dist/types/src/common/src/template/loader/loader.d.ts +18 -0
  187. package/dist/types/src/common/src/template/loader/loader.test.d.ts +1 -0
  188. package/dist/types/src/common/src/template/paths.d.ts +14 -0
  189. package/dist/types/src/common/src/template/paths.test.d.ts +1 -0
  190. package/dist/types/src/common/src/template/types.d.ts +299 -0
  191. package/dist/types/src/dev/dev.d.ts +21 -0
  192. package/dist/types/src/dev/server/autoInit.d.ts +1 -0
  193. package/dist/types/src/dev/server/middleware/constants.d.ts +8 -0
  194. package/dist/types/src/dev/server/middleware/errorMiddleware.d.ts +3 -0
  195. package/dist/types/src/dev/server/middleware/finalSlashRedirect.d.ts +4 -0
  196. package/dist/types/src/dev/server/middleware/finalSlashRedirect.test.d.ts +1 -0
  197. package/dist/types/src/dev/server/middleware/getContentType.d.ts +6 -0
  198. package/dist/types/src/dev/server/middleware/ignoreFavicon.d.ts +1 -0
  199. package/dist/types/src/dev/server/middleware/indexPage.d.ts +14 -0
  200. package/dist/types/src/dev/server/middleware/send404.d.ts +2 -0
  201. package/dist/types/src/dev/server/middleware/sendAppHTML.d.ts +10 -0
  202. package/dist/types/src/dev/server/middleware/serveHttpFunction.d.ts +5 -0
  203. package/dist/types/src/dev/server/middleware/serveModule.d.ts +7 -0
  204. package/dist/types/src/dev/server/middleware/serverRenderModule.d.ts +8 -0
  205. package/dist/types/src/dev/server/middleware/serverRenderRoute.d.ts +13 -0
  206. package/dist/types/src/dev/server/middleware/serverRenderSlugRoute.d.ts +13 -0
  207. package/dist/types/src/dev/server/server.d.ts +5 -0
  208. package/dist/types/src/dev/server/ssr/constants.d.ts +7 -0
  209. package/dist/types/src/dev/server/ssr/findMatchingModule.d.ts +19 -0
  210. package/dist/types/src/dev/server/ssr/findMatchingStaticTemplate.d.ts +20 -0
  211. package/dist/types/src/dev/server/ssr/findTemplateModuleInternal.d.ts +4 -0
  212. package/dist/types/src/dev/server/ssr/generateTestData.d.ts +13 -0
  213. package/dist/types/src/dev/server/ssr/generateTestData.test.d.ts +1 -0
  214. package/dist/types/src/dev/server/ssr/getLocalData.d.ts +46 -0
  215. package/dist/types/src/dev/server/ssr/getPluginFileMap.d.ts +25 -0
  216. package/dist/types/src/dev/server/ssr/inPlatformPageSets.d.ts +21 -0
  217. package/dist/types/src/dev/server/ssr/inPlatformPageSets.test.d.ts +1 -0
  218. package/dist/types/src/dev/server/ssr/loadViteModule.d.ts +2 -0
  219. package/dist/types/src/dev/server/ssr/moduleImports.d.ts +10 -0
  220. package/dist/types/src/dev/server/ssr/moduleImports.test.d.ts +1 -0
  221. package/dist/types/src/dev/server/ssr/parseNonProdUrl.d.ts +8 -0
  222. package/dist/types/src/dev/server/ssr/propsLoader.d.ts +8 -0
  223. package/dist/types/src/dev/server/ssr/types.d.ts +18 -0
  224. package/dist/types/src/generate/artifacts/artifacts.d.ts +5 -0
  225. package/dist/types/src/generate/artifacts/createArtifactsJson.d.ts +15 -0
  226. package/dist/types/src/generate/artifacts/createArtifactsJson.test.d.ts +1 -0
  227. package/dist/types/src/generate/ci/ci.d.ts +18 -0
  228. package/dist/types/src/generate/ci/ci.test.d.ts +1 -0
  229. package/dist/types/src/generate/features/features.d.ts +2 -0
  230. package/dist/types/src/generate/generate.d.ts +2 -0
  231. package/dist/types/src/generate/templates/createTemplatesJson.d.ts +29 -0
  232. package/dist/types/src/generate/templates/createTemplatesJson.test.d.ts +1 -0
  233. package/dist/types/src/generate/templates/templates.d.ts +5 -0
  234. package/dist/types/src/index.d.ts +8 -0
  235. package/dist/types/src/plugins/index.d.ts +1 -0
  236. package/dist/types/src/plugins/onUrlChange/urlWriteback.d.ts +24 -0
  237. package/dist/types/src/plugins/onUrlChange/urlWriteback.test.d.ts +1 -0
  238. package/dist/types/src/plugins/onUrlChange/yext.d.ts +24 -0
  239. package/dist/types/src/prod/prod.d.ts +2 -0
  240. package/dist/types/src/scaffold/modules/generate.d.ts +8 -0
  241. package/dist/types/src/scaffold/modules/generate.test.d.ts +1 -0
  242. package/dist/types/src/scaffold/modules/modules.d.ts +2 -0
  243. package/dist/types/src/scaffold/modules/templates.d.ts +6 -0
  244. package/dist/types/src/scaffold/modules/templates.test.d.ts +1 -0
  245. package/dist/types/src/scaffold/scaffold.d.ts +2 -0
  246. package/dist/types/src/scaffold/template/generate.d.ts +2 -0
  247. package/dist/types/src/scaffold/template/sampleTemplates.d.ts +9 -0
  248. package/dist/types/src/scaffold/template/sampleTemplates.test.d.ts +1 -0
  249. package/dist/types/src/scaffold/template/template.d.ts +2 -0
  250. package/dist/types/src/upgrade/migrateConfig.d.ts +16 -0
  251. package/dist/types/src/upgrade/migrateConfig.test.d.ts +1 -0
  252. package/dist/types/src/upgrade/pagesUpdater.d.ts +97 -0
  253. package/dist/types/src/upgrade/pagesUpdater.test.d.ts +1 -0
  254. package/dist/types/src/upgrade/upgrade.d.ts +2 -0
  255. package/dist/types/src/util/applyReverseProxy.d.ts +41 -0
  256. package/dist/types/src/util/applyReverseProxy.test.d.ts +1 -0
  257. package/dist/types/src/util/checkInstalled.d.ts +2 -0
  258. package/dist/types/src/util/checkInstalled.test.d.ts +1 -0
  259. package/dist/types/src/util/config.d.ts +1 -0
  260. package/dist/types/src/util/createTestSourceFile.d.ts +12 -0
  261. package/dist/types/src/util/dynamic.d.ts +52 -0
  262. package/dist/types/src/util/editConfigYaml.d.ts +14 -0
  263. package/dist/types/src/util/env.d.ts +12 -0
  264. package/dist/types/src/util/env.test.d.ts +1 -0
  265. package/dist/types/src/util/fileContentHash.d.ts +4 -0
  266. package/dist/types/src/util/fileContentHash.test.d.ts +1 -0
  267. package/dist/types/src/util/index.d.ts +4 -0
  268. package/dist/types/src/util/logError.d.ts +10 -0
  269. package/dist/types/src/util/partition.d.ts +9 -0
  270. package/dist/types/src/util/partition.test.d.ts +1 -0
  271. package/dist/types/src/util/processEnvVariables.d.ts +8 -0
  272. package/dist/types/src/util/processEnvVariables.test.d.ts +1 -0
  273. package/dist/types/src/util/resolveApiBase.d.ts +10 -0
  274. package/dist/types/src/util/runSubprocess.d.ts +8 -0
  275. package/dist/types/src/util/runSubprocess.test.d.ts +1 -0
  276. package/dist/types/src/util/runtime.d.ts +26 -0
  277. package/dist/types/src/util/runtime.test.d.ts +8 -0
  278. package/dist/types/src/util/url.d.ts +11 -0
  279. package/dist/types/src/util/url.test.d.ts +1 -0
  280. package/dist/types/src/util/useDocument.d.ts +8 -0
  281. package/dist/types/src/util/yextrcContents.d.ts +12 -0
  282. package/dist/types/src/util/yextrcContents.test.d.ts +1 -0
  283. package/dist/types/src/vite-plugin/build/build.d.ts +8 -0
  284. package/dist/types/src/vite-plugin/build/buildStart/buildStart.d.ts +21 -0
  285. package/dist/types/src/vite-plugin/build/buildStart/rendering/redirectUtils.d.ts +19 -0
  286. package/dist/types/src/vite-plugin/build/buildStart/rendering/renderer.d.ts +15 -0
  287. package/dist/types/src/vite-plugin/build/buildStart/rendering/templateUtils.d.ts +37 -0
  288. package/dist/types/src/vite-plugin/build/buildStart/rendering/templateUtils.test.d.ts +1 -0
  289. package/dist/types/src/vite-plugin/build/buildStart/rendering/wrapper.d.ts +15 -0
  290. package/dist/types/src/vite-plugin/build/closeBundle/bundleValidator.d.ts +8 -0
  291. package/dist/types/src/vite-plugin/build/closeBundle/bundleValidator.test.d.ts +1 -0
  292. package/dist/types/src/vite-plugin/build/closeBundle/bundleValidatorHelper.d.ts +3 -0
  293. package/dist/types/src/vite-plugin/build/closeBundle/closeBundle.d.ts +6 -0
  294. package/dist/types/src/vite-plugin/build/closeBundle/functionMetadata.d.ts +5 -0
  295. package/dist/types/src/vite-plugin/build/closeBundle/manifest.d.ts +9 -0
  296. package/dist/types/src/vite-plugin/clientHydration.d.ts +2 -0
  297. package/dist/types/src/vite-plugin/clientHydration.test.d.ts +1 -0
  298. package/dist/types/src/vite-plugin/index.d.ts +1 -0
  299. package/dist/types/src/vite-plugin/log.d.ts +12 -0
  300. package/dist/types/src/vite-plugin/modules/plugin.d.ts +4 -0
  301. package/dist/types/src/vite-plugin/plugin.d.ts +4 -0
  302. package/dist/types/src/vite-plugin/serverless-functions/plugin.d.ts +3 -0
  303. package/dist/types/src/vite-plugin/timing.d.ts +8 -0
  304. package/dist/types/tests/fixtures/cli_boilerplate.d.ts +4 -0
  305. package/dist/types/tests/fixtures/cli_stream_data.d.ts +214 -0
  306. package/dist/types/tests/fixtures/feature_config.d.ts +3 -0
  307. package/dist/upgrade/migrateConfig.js +200 -0
  308. package/dist/upgrade/pagesUpdater.js +496 -0
  309. package/dist/upgrade/upgrade.js +47 -0
  310. package/dist/util/applyReverseProxy.js +321 -0
  311. package/dist/util/checkInstalled.js +16 -0
  312. package/dist/util/config.js +11 -0
  313. package/dist/util/createTestSourceFile.js +20 -0
  314. package/dist/util/dynamic.js +35 -0
  315. package/dist/util/editConfigYaml.js +29 -0
  316. package/dist/util/env.js +9 -0
  317. package/dist/util/fileContentHash.js +9 -0
  318. package/dist/util/index.js +11 -0
  319. package/dist/util/logError.js +16 -0
  320. package/dist/util/partition.js +13 -0
  321. package/dist/util/processEnvVariables.js +32 -0
  322. package/dist/util/resolveApiBase.js +32 -0
  323. package/dist/util/runSubprocess.js +26 -0
  324. package/dist/util/runtime.js +42 -0
  325. package/dist/util/url.js +43 -0
  326. package/dist/util/useDocument.js +19 -0
  327. package/dist/util/yextrcContents.js +24 -0
  328. package/dist/vite-plugin/build/build.js +71 -0
  329. package/dist/vite-plugin/build/buildStart/buildStart.js +138 -0
  330. package/dist/vite-plugin/build/buildStart/rendering/redirectUtils.js +35 -0
  331. package/dist/vite-plugin/build/buildStart/rendering/renderer.js +48 -0
  332. package/dist/vite-plugin/build/buildStart/rendering/templateUtils.js +103 -0
  333. package/dist/vite-plugin/build/buildStart/rendering/wrapper.js +75 -0
  334. package/dist/vite-plugin/build/closeBundle/bundleValidator.js +24 -0
  335. package/dist/vite-plugin/build/closeBundle/bundleValidatorHelper.js +16 -0
  336. package/dist/vite-plugin/build/closeBundle/closeBundle.js +218 -0
  337. package/dist/vite-plugin/build/closeBundle/functionMetadata.js +66 -0
  338. package/dist/vite-plugin/build/closeBundle/manifest.js +71 -0
  339. package/dist/vite-plugin/clientHydration.js +24 -0
  340. package/dist/vite-plugin/index.js +4 -0
  341. package/dist/vite-plugin/log.js +20 -0
  342. package/dist/vite-plugin/modules/plugin.js +226 -0
  343. package/dist/vite-plugin/plugin.js +52 -0
  344. package/dist/vite-plugin/serverless-functions/plugin.js +111 -0
  345. package/dist/vite-plugin/timing.js +13 -0
  346. package/package.json +116 -4
package/LICENSE ADDED
@@ -0,0 +1,32 @@
1
+ The Pages files listed in this repository are licensed under the below license. All other features and products are subject to separate agreements
2
+ and certain functionality requires paid subscriptions to Yext products.
3
+
4
+ BSD 3-Clause License
5
+
6
+ Copyright (c) 2022, Yext
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without
10
+ modification, are permitted provided that the following conditions are met:
11
+
12
+ 1. Redistributions of source code must retain the above copyright notice, this
13
+ list of conditions and the following disclaimer.
14
+
15
+ 2. Redistributions in binary form must reproduce the above copyright notice,
16
+ this list of conditions and the following disclaimer in the documentation
17
+ and/or other materials provided with the distribution.
18
+
19
+ 3. Neither the name of the copyright holder nor the names of its
20
+ contributors may be used to endorse or promote products derived from
21
+ this software without specific prior written permission.
22
+
23
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
27
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
31
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,3 +1,126 @@
1
- # Temporary Holding Version
1
+ # pages
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `pages` is the main package that exports different subpackages, all designed to make it easy to develop on the Yext Pages platform using JavaScript.
4
+
5
+ ## Subpackages
6
+
7
+ All folders below live at `packages/pages/src`.
8
+
9
+ ### bin
10
+
11
+ The main binary exported as `pages`. The two important commands are:
12
+
13
+ - `pages init`
14
+ - Clones the [starter repo](https://github.com/yext/pages-starter-react-locations), runs `npm install`, and performs the first build, all in one simple command. The actual init functionality lives in [`/init`](#init).
15
+ - `pages dev`
16
+ - Runs a custom local development server that is backed by [Vite](https://vitejs.dev/). The actual dev server functionality lives in [`/dev`](#dev).
17
+
18
+ ### common
19
+
20
+ Contains any code shared between the other subpackages. It also contains public types and internal domain types.
21
+
22
+ ### dev
23
+
24
+ All of the code related to the custom local dev server lives here. The server itself is an Express server that's backed by [Vite](https://vitejs.dev/), giving us ultra fast HMR (hot module replacement) out of the box.
25
+
26
+ In general, local dev was set up to be similar to how NextJS works. Every unique page is a separate file in your own repository's `src/templates` folder. The default export in each file represents the template entrypoint.
27
+
28
+ ### init
29
+
30
+ The actual code relating to the `pages init` function.
31
+
32
+ ### util
33
+
34
+ Contains helper utility functions that could be useful to someone using PagesJS. For instance, we have a custom `fetch` function that allows it to work across different runtime environments (Node vs. Deno vs. Browser).
35
+
36
+ ### vite-plugin
37
+
38
+ This is a plugin to be used with Vite specifically. It provides an opinioned but easy-to-use way to bundle your code for production. Where [`/dev`](#dev) builds for local development, `/vite-plugin` builds for production.
39
+
40
+ ## Development
41
+
42
+ `pages` has a number of scripts to assist with development. Since the tool is meant to be
43
+ used alongside a repository set up for Yext Pages, it is recommended that any changes are tested
44
+ against a starter repository. One such starter repo is [yext/pages-starter-react-locations](https://github.com/yext/pages-starter-react-locations).
45
+
46
+ By default, the starter repository references a non-local version of `@yext/pages`. To point
47
+ the starter at this local repository, first run `pnpm pack` in `./packages/pages`, then update the starter's `package.json`'s `@yext/pages`
48
+ dependency to `file:../path/to/the/pack.tgz`.
49
+
50
+ Also see the [Contributing Guide](https://github.com/yext/pages/blob/main/CONTRIBUTING.md#repo-setup).
51
+
52
+ #
53
+
54
+ ```
55
+ pnpm build
56
+ ```
57
+
58
+ This command uses esbuild to transpile assets and puts them into `dist`. Since this package's `bin`
59
+ specifies an entry-point in the `dist` directory you'll need to run this command whenever you make
60
+ changes in source so that they're picked up in any test repositories you're working on.
61
+
62
+ ```
63
+ pnpm build:release
64
+ ```
65
+
66
+ Similar to `pnpm build` but also runs types.
67
+
68
+ ```
69
+ pnpm watch
70
+ ```
71
+
72
+ This command does the same this as `build` except it does it in watchmode anytime a source file is
73
+ updated the build will be automatically re-run.
74
+
75
+ ```
76
+ pnpm types
77
+ ```
78
+
79
+ This command runs `tsc` to generate type declaration files and outputs them in `dist/types`.
80
+
81
+ ```
82
+ pnpm fmt
83
+ ```
84
+
85
+ This command runs prettier for standardized formatting across all files.
86
+
87
+ ```
88
+ pnpm docs:dev
89
+ ```
90
+
91
+ This command will start the Vitepress devserver with hot module reloading to quickly test changes to documentation. It will generate a webpage for each markdown file in the `docs` directory according to the config specified in `docs/.vitepress/config.ts`
92
+
93
+ ```
94
+ pnpm docs:build
95
+ ```
96
+
97
+ This command will use Vitepress to fully build the html pages for the documentation site and puts them into `docs/.vitepress/dist`. Similar to the `docs:dev` command, it will generate an html page for each markdown file in the `docs` directory according to the configuration specified in `docs/.vitepress/config.ts`.
98
+
99
+ ```
100
+ pnpm docs:serve
101
+ ```
102
+
103
+ This command will run the same build as the `docs:build` command and it will then serve the fully generated html files on a local server. This allows inspection of the documentation webpages in a way that's fully consistent with what will be served on the real website.
104
+
105
+ ```
106
+ pnpm test
107
+ ```
108
+
109
+ This command will run all the tests in the package using Vitest as the test runner.
110
+
111
+ ## Commands to Use in a Starter
112
+
113
+ ```
114
+ pages dev
115
+ ```
116
+
117
+ This command starts a devserver with hot module reloading to be used to quickly test changes to
118
+ JS templates.
119
+
120
+ ```
121
+ vite build
122
+ ```
123
+
124
+ This command runs a production build on your repo. It minifies and fingerprints assets so they are
125
+ prepared to be statically served by a webserver. Additionally provides a default Yext Plugin to
126
+ generate html pages from JS templates and prepares the template modules for generation.