@sfdc-webapps/cli 1.0.2

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 (405) hide show
  1. package/README.md +1414 -0
  2. package/dist/commands/apply-patches.d.ts +23 -0
  3. package/dist/commands/apply-patches.d.ts.map +1 -0
  4. package/dist/commands/apply-patches.js +524 -0
  5. package/dist/commands/apply-patches.js.map +1 -0
  6. package/dist/commands/new-app-feature.d.ts +7 -0
  7. package/dist/commands/new-app-feature.d.ts.map +1 -0
  8. package/dist/commands/new-app-feature.js +166 -0
  9. package/dist/commands/new-app-feature.js.map +1 -0
  10. package/dist/commands/new-app.d.ts +1 -0
  11. package/dist/commands/new-app.d.ts.map +1 -0
  12. package/dist/commands/new-app.js +2 -0
  13. package/dist/commands/new-app.js.map +1 -0
  14. package/dist/commands/watch-patches.d.ts +6 -0
  15. package/dist/commands/watch-patches.d.ts.map +1 -0
  16. package/dist/commands/watch-patches.js +152 -0
  17. package/dist/commands/watch-patches.js.map +1 -0
  18. package/dist/core/dependency-resolver.d.ts +40 -0
  19. package/dist/core/dependency-resolver.d.ts.map +1 -0
  20. package/dist/core/dependency-resolver.js +122 -0
  21. package/dist/core/dependency-resolver.js.map +1 -0
  22. package/dist/core/file-operations.d.ts +37 -0
  23. package/dist/core/file-operations.d.ts.map +1 -0
  24. package/dist/core/file-operations.js +201 -0
  25. package/dist/core/file-operations.js.map +1 -0
  26. package/dist/core/package-json-merger.d.ts +30 -0
  27. package/dist/core/package-json-merger.d.ts.map +1 -0
  28. package/dist/core/package-json-merger.js +104 -0
  29. package/dist/core/package-json-merger.js.map +1 -0
  30. package/dist/core/patch-loader.d.ts +17 -0
  31. package/dist/core/patch-loader.d.ts.map +1 -0
  32. package/dist/core/patch-loader.js +100 -0
  33. package/dist/core/patch-loader.js.map +1 -0
  34. package/dist/index.d.ts +3 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +90 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/types.d.ts +21 -0
  39. package/dist/types.d.ts.map +1 -0
  40. package/dist/types.js +2 -0
  41. package/dist/types.js.map +1 -0
  42. package/dist/utils/debounce.d.ts +6 -0
  43. package/dist/utils/debounce.d.ts.map +1 -0
  44. package/dist/utils/debounce.js +19 -0
  45. package/dist/utils/debounce.js.map +1 -0
  46. package/dist/utils/import-merger.d.ts +12 -0
  47. package/dist/utils/import-merger.d.ts.map +1 -0
  48. package/dist/utils/import-merger.js +240 -0
  49. package/dist/utils/import-merger.js.map +1 -0
  50. package/dist/utils/logger.d.ts +6 -0
  51. package/dist/utils/logger.d.ts.map +1 -0
  52. package/dist/utils/logger.js +17 -0
  53. package/dist/utils/logger.js.map +1 -0
  54. package/dist/utils/path-mappings.d.ts +88 -0
  55. package/dist/utils/path-mappings.d.ts.map +1 -0
  56. package/dist/utils/path-mappings.js +138 -0
  57. package/dist/utils/path-mappings.js.map +1 -0
  58. package/dist/utils/paths.d.ts +43 -0
  59. package/dist/utils/paths.d.ts.map +1 -0
  60. package/dist/utils/paths.js +107 -0
  61. package/dist/utils/paths.js.map +1 -0
  62. package/dist/utils/route-merger.d.ts +107 -0
  63. package/dist/utils/route-merger.d.ts.map +1 -0
  64. package/dist/utils/route-merger.js +303 -0
  65. package/dist/utils/route-merger.js.map +1 -0
  66. package/dist/utils/validation.d.ts +29 -0
  67. package/dist/utils/validation.d.ts.map +1 -0
  68. package/dist/utils/validation.js +109 -0
  69. package/dist/utils/validation.js.map +1 -0
  70. package/package.json +39 -0
  71. package/src/commands/apply-patches.ts +594 -0
  72. package/src/commands/new-app-feature.ts +203 -0
  73. package/src/commands/new-app.ts +0 -0
  74. package/src/commands/watch-patches.ts +173 -0
  75. package/src/core/dependency-resolver.ts +175 -0
  76. package/src/core/file-operations.ts +265 -0
  77. package/src/core/package-json-merger.ts +129 -0
  78. package/src/core/patch-loader.ts +128 -0
  79. package/src/index.ts +95 -0
  80. package/src/types.ts +23 -0
  81. package/src/utils/debounce.ts +23 -0
  82. package/src/utils/import-merger.ts +293 -0
  83. package/src/utils/logger.ts +21 -0
  84. package/src/utils/path-mappings.ts +154 -0
  85. package/src/utils/paths.ts +121 -0
  86. package/src/utils/route-merger.ts +357 -0
  87. package/src/utils/validation.ts +150 -0
  88. package/test/e2e/E2E_TEST_FIXTURES.md +509 -0
  89. package/test/e2e/apply-patches.spec.ts +861 -0
  90. package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/package.json +10 -0
  91. package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/appLayout.tsx +27 -0
  92. package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/home.tsx +8 -0
  93. package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/index.tsx +10 -0
  94. package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/old-page.tsx +8 -0
  95. package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/routes.tsx +23 -0
  96. package/test/e2e/fixtures/base-app/digitalExperiences/webApplications/base-app/src/styles/global.css +14 -0
  97. package/test/e2e/fixtures/basic-operations/dep-chain-linear/feature.ts +11 -0
  98. package/test/e2e/fixtures/basic-operations/dep-chain-linear/template/digitalExperiences/webApplications/dep-chain-linear/src/__inherit__appLayout.tsx +27 -0
  99. package/test/e2e/fixtures/basic-operations/dep-chain-linear/template/digitalExperiences/webApplications/dep-chain-linear/src/contact.tsx +8 -0
  100. package/test/e2e/fixtures/basic-operations/dep-chain-linear/template/digitalExperiences/webApplications/dep-chain-linear/src/routes.tsx +17 -0
  101. package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/feature.ts +10 -0
  102. package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/template/digitalExperiences/webApplications/feature-file-inherit-route-add/src/__inherit__appLayout.tsx +27 -0
  103. package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/template/digitalExperiences/webApplications/feature-file-inherit-route-add/src/__inherit__home.tsx +0 -0
  104. package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/template/digitalExperiences/webApplications/feature-file-inherit-route-add/src/about.tsx +8 -0
  105. package/test/e2e/fixtures/basic-operations/feature-file-inherit-route-add/template/digitalExperiences/webApplications/feature-file-inherit-route-add/src/routes.tsx +17 -0
  106. package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/feature.ts +10 -0
  107. package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/__inherit__appLayout.tsx +27 -0
  108. package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/__prepend__index.tsx +2 -0
  109. package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/routes.tsx +17 -0
  110. package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/settings.tsx +9 -0
  111. package/test/e2e/fixtures/basic-operations/feature-file-prepend-append/template/digitalExperiences/webApplications/feature-file-prepend-append/src/styles/__append__global.css +10 -0
  112. package/test/e2e/fixtures/basic-operations/feature-file-route-delete/feature.ts +10 -0
  113. package/test/e2e/fixtures/basic-operations/feature-file-route-delete/template/digitalExperiences/webApplications/feature-file-route-delete/src/__delete__old-page.tsx +2 -0
  114. package/test/e2e/fixtures/basic-operations/feature-file-route-delete/template/digitalExperiences/webApplications/feature-file-route-delete/src/__inherit__appLayout.tsx +27 -0
  115. package/test/e2e/fixtures/basic-operations/feature-file-route-delete/template/digitalExperiences/webApplications/feature-file-route-delete/src/routes.tsx +16 -0
  116. package/test/e2e/fixtures/composition-5-features/5-features-about/feature.ts +3 -0
  117. package/test/e2e/fixtures/composition-5-features/5-features-about/template/digitalExperiences/webApplications/5-features-about/src/about.tsx +8 -0
  118. package/test/e2e/fixtures/composition-5-features/5-features-about/template/digitalExperiences/webApplications/5-features-about/src/routes.tsx +17 -0
  119. package/test/e2e/fixtures/composition-5-features/5-features-analytics/feature.ts +3 -0
  120. package/test/e2e/fixtures/composition-5-features/5-features-analytics/template/digitalExperiences/webApplications/5-features-analytics/src/__prepend__index.tsx +2 -0
  121. package/test/e2e/fixtures/composition-5-features/5-features-footer/feature.ts +3 -0
  122. package/test/e2e/fixtures/composition-5-features/5-features-footer/template/digitalExperiences/webApplications/5-features-footer/src/footer.tsx +7 -0
  123. package/test/e2e/fixtures/composition-5-features/5-features-footer/template/digitalExperiences/webApplications/5-features-footer/src/routes.tsx +17 -0
  124. package/test/e2e/fixtures/composition-5-features/5-features-navigation/feature.ts +3 -0
  125. package/test/e2e/fixtures/composition-5-features/5-features-navigation/template/digitalExperiences/webApplications/5-features-navigation/src/navigation.tsx +7 -0
  126. package/test/e2e/fixtures/composition-5-features/5-features-navigation/template/digitalExperiences/webApplications/5-features-navigation/src/routes.tsx +17 -0
  127. package/test/e2e/fixtures/composition-5-features/5-features-theme/feature.ts +3 -0
  128. package/test/e2e/fixtures/composition-5-features/5-features-theme/template/digitalExperiences/webApplications/5-features-theme/src/styles/__append__global.css +5 -0
  129. package/test/e2e/fixtures/composition-append/composition-append-1/feature.ts +10 -0
  130. package/test/e2e/fixtures/composition-append/composition-append-1/template/digitalExperiences/webApplications/composition-append-1/src/styles/__append__global.css +4 -0
  131. package/test/e2e/fixtures/composition-append/composition-append-2/feature.ts +10 -0
  132. package/test/e2e/fixtures/composition-append/composition-append-2/template/digitalExperiences/webApplications/composition-append-2/src/styles/__append__global.css +4 -0
  133. package/test/e2e/fixtures/composition-append/composition-append-3/feature.ts +10 -0
  134. package/test/e2e/fixtures/composition-append/composition-append-3/template/digitalExperiences/webApplications/composition-append-3/src/styles/__append__global.css +4 -0
  135. package/test/e2e/fixtures/composition-inherit-modify/composition-inherit-layout/feature.ts +3 -0
  136. package/test/e2e/fixtures/composition-inherit-modify/composition-inherit-layout/template/digitalExperiences/webApplications/composition-inherit-layout/src/__inherit__appLayout.tsx +1 -0
  137. package/test/e2e/fixtures/composition-inherit-modify/composition-modify-layout/feature.ts +3 -0
  138. package/test/e2e/fixtures/composition-inherit-modify/composition-modify-layout/template/digitalExperiences/webApplications/composition-modify-layout/src/__append__appLayout.tsx +2 -0
  139. package/test/e2e/fixtures/composition-prepend/composition-prepend-1/feature.ts +10 -0
  140. package/test/e2e/fixtures/composition-prepend/composition-prepend-1/template/digitalExperiences/webApplications/composition-prepend-1/src/__prepend__index.tsx +2 -0
  141. package/test/e2e/fixtures/composition-prepend/composition-prepend-2/feature.ts +10 -0
  142. package/test/e2e/fixtures/composition-prepend/composition-prepend-2/template/digitalExperiences/webApplications/composition-prepend-2/src/__prepend__index.tsx +2 -0
  143. package/test/e2e/fixtures/composition-prepend/composition-prepend-3/feature.ts +10 -0
  144. package/test/e2e/fixtures/composition-prepend/composition-prepend-3/template/digitalExperiences/webApplications/composition-prepend-3/src/__prepend__index.tsx +2 -0
  145. package/test/e2e/fixtures/dep-chain-long/dep-chain-a/feature.ts +11 -0
  146. package/test/e2e/fixtures/dep-chain-long/dep-chain-a/template/digitalExperiences/webApplications/dep-chain-a/src/page-a.tsx +8 -0
  147. package/test/e2e/fixtures/dep-chain-long/dep-chain-a/template/digitalExperiences/webApplications/dep-chain-a/src/routes.tsx +17 -0
  148. package/test/e2e/fixtures/dep-chain-long/dep-chain-b/feature.ts +11 -0
  149. package/test/e2e/fixtures/dep-chain-long/dep-chain-b/template/digitalExperiences/webApplications/dep-chain-b/src/page-b.tsx +8 -0
  150. package/test/e2e/fixtures/dep-chain-long/dep-chain-b/template/digitalExperiences/webApplications/dep-chain-b/src/routes.tsx +17 -0
  151. package/test/e2e/fixtures/dep-chain-long/dep-chain-c/feature.ts +11 -0
  152. package/test/e2e/fixtures/dep-chain-long/dep-chain-c/template/digitalExperiences/webApplications/dep-chain-c/src/page-c.tsx +8 -0
  153. package/test/e2e/fixtures/dep-chain-long/dep-chain-c/template/digitalExperiences/webApplications/dep-chain-c/src/routes.tsx +17 -0
  154. package/test/e2e/fixtures/dep-chain-long/dep-chain-d/feature.ts +10 -0
  155. package/test/e2e/fixtures/dep-chain-long/dep-chain-d/template/digitalExperiences/webApplications/dep-chain-d/src/page-d.tsx +8 -0
  156. package/test/e2e/fixtures/dep-chain-long/dep-chain-d/template/digitalExperiences/webApplications/dep-chain-d/src/routes.tsx +17 -0
  157. package/test/e2e/fixtures/dep-circular/dep-circular-a/feature.ts +11 -0
  158. package/test/e2e/fixtures/dep-circular/dep-circular-a/template/digitalExperiences/webApplications/dep-circular-a/src/page-a.tsx +8 -0
  159. package/test/e2e/fixtures/dep-circular/dep-circular-b/feature.ts +11 -0
  160. package/test/e2e/fixtures/dep-circular/dep-circular-b/template/digitalExperiences/webApplications/dep-circular-b/src/page-b.tsx +8 -0
  161. package/test/e2e/fixtures/dep-complex-graph/README.md +119 -0
  162. package/test/e2e/fixtures/dep-complex-graph/create-placeholders.sh +25 -0
  163. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/feature.ts +14 -0
  164. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/__delete__old-page.tsx +1 -0
  165. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/__inherit__appLayout.tsx +1 -0
  166. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/login.tsx +8 -0
  167. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/routes.tsx +29 -0
  168. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-auth/template/digitalExperiences/webApplications/dep-complex-graph-auth/src/signup.tsx +1 -0
  169. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/feature.ts +14 -0
  170. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/__inherit__appLayout.tsx +1 -0
  171. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/analytics.tsx +1 -0
  172. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/dashboard.tsx +8 -0
  173. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/reports.tsx +1 -0
  174. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-dashboard/template/digitalExperiences/webApplications/dep-complex-graph-dashboard/src/routes.tsx +32 -0
  175. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/feature.ts +14 -0
  176. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/template/digitalExperiences/webApplications/dep-complex-graph-profile/src/__inherit__appLayout.tsx +1 -0
  177. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/template/digitalExperiences/webApplications/dep-complex-graph-profile/src/profile-edit.tsx +1 -0
  178. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/template/digitalExperiences/webApplications/dep-complex-graph-profile/src/profile.tsx +8 -0
  179. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-profile/template/digitalExperiences/webApplications/dep-complex-graph-profile/src/routes.tsx +26 -0
  180. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-components/feature.ts +14 -0
  181. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-components/template/digitalExperiences/webApplications/dep-complex-graph-shared-components/src/__inherit__appLayout.tsx +1 -0
  182. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-components/template/digitalExperiences/webApplications/dep-complex-graph-shared-components/src/components.tsx +8 -0
  183. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-components/template/digitalExperiences/webApplications/dep-complex-graph-shared-components/src/routes.tsx +18 -0
  184. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-types/feature.ts +10 -0
  185. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-types/template/digitalExperiences/webApplications/dep-complex-graph-shared-types/src/__inherit__appLayout.tsx +1 -0
  186. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-types/template/digitalExperiences/webApplications/dep-complex-graph-shared-types/src/routes.tsx +17 -0
  187. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-types/template/digitalExperiences/webApplications/dep-complex-graph-shared-types/src/types.tsx +8 -0
  188. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-utils/feature.ts +10 -0
  189. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-utils/template/digitalExperiences/webApplications/dep-complex-graph-shared-utils/src/__inherit__appLayout.tsx +1 -0
  190. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-utils/template/digitalExperiences/webApplications/dep-complex-graph-shared-utils/src/routes.tsx +18 -0
  191. package/test/e2e/fixtures/dep-complex-graph/dep-complex-graph-shared-utils/template/digitalExperiences/webApplications/dep-complex-graph-shared-utils/src/tools.tsx +1 -0
  192. package/test/e2e/fixtures/dep-complex-graph/feature.ts +15 -0
  193. package/test/e2e/fixtures/dep-complex-graph/template/digitalExperiences/webApplications/dep-complex-graph/src/__inherit__appLayout.tsx +1 -0
  194. package/test/e2e/fixtures/dep-complex-graph/template/digitalExperiences/webApplications/dep-complex-graph/src/admin-dashboard.tsx +1 -0
  195. package/test/e2e/fixtures/dep-complex-graph/template/digitalExperiences/webApplications/dep-complex-graph/src/admin-layout.tsx +1 -0
  196. package/test/e2e/fixtures/dep-complex-graph/template/digitalExperiences/webApplications/dep-complex-graph/src/routes.tsx +24 -0
  197. package/test/e2e/fixtures/dep-diamond/dep-diamond-left/feature.ts +11 -0
  198. package/test/e2e/fixtures/dep-diamond/dep-diamond-left/template/digitalExperiences/webApplications/dep-diamond-left/src/left-page.tsx +8 -0
  199. package/test/e2e/fixtures/dep-diamond/dep-diamond-left/template/digitalExperiences/webApplications/dep-diamond-left/src/routes.tsx +17 -0
  200. package/test/e2e/fixtures/dep-diamond/dep-diamond-right/feature.ts +11 -0
  201. package/test/e2e/fixtures/dep-diamond/dep-diamond-right/template/digitalExperiences/webApplications/dep-diamond-right/src/right-page.tsx +8 -0
  202. package/test/e2e/fixtures/dep-diamond/dep-diamond-right/template/digitalExperiences/webApplications/dep-diamond-right/src/routes.tsx +17 -0
  203. package/test/e2e/fixtures/dep-diamond/dep-diamond-shared/feature.ts +10 -0
  204. package/test/e2e/fixtures/dep-diamond/dep-diamond-shared/template/digitalExperiences/webApplications/dep-diamond-shared/src/routes.tsx +17 -0
  205. package/test/e2e/fixtures/dep-diamond/dep-diamond-shared/template/digitalExperiences/webApplications/dep-diamond-shared/src/shared-utils.tsx +8 -0
  206. package/test/e2e/fixtures/edges/edge-binary-files/feature.ts +13 -0
  207. package/test/e2e/fixtures/edges/edge-binary-files/template/digitalExperiences/webApplications/edge-binary-files/src/__inherit__appLayout.tsx +1 -0
  208. package/test/e2e/fixtures/edges/edge-binary-files/template/digitalExperiences/webApplications/edge-binary-files/src/assets/test-image.png +0 -0
  209. package/test/e2e/fixtures/edges/edge-binary-files/template/digitalExperiences/webApplications/edge-binary-files/src/placeholder.tsx +0 -0
  210. package/test/e2e/fixtures/edges/edge-conflicting-prefixes/feature.ts +13 -0
  211. package/test/e2e/fixtures/edges/edge-conflicting-prefixes/template/digitalExperiences/webApplications/edge-conflicting-prefixes/src/__inherit____delete__conflicting.tsx +5 -0
  212. package/test/e2e/fixtures/edges/edge-conflicting-prefixes/template/digitalExperiences/webApplications/edge-conflicting-prefixes/src/placeholder.tsx +0 -0
  213. package/test/e2e/fixtures/edges/edge-empty-feature/feature.ts +16 -0
  214. package/test/e2e/fixtures/edges/edge-empty-feature/template/digitalExperiences/webApplications/edge-empty-feature/src/placeholder.tsx +0 -0
  215. package/test/e2e/fixtures/edges/edge-invalid-routes/feature.ts +12 -0
  216. package/test/e2e/fixtures/edges/edge-invalid-routes/template/digitalExperiences/webApplications/edge-invalid-routes/src/placeholder.tsx +0 -0
  217. package/test/e2e/fixtures/edges/edge-invalid-routes/template/digitalExperiences/webApplications/edge-invalid-routes/src/routes.tsx +8 -0
  218. package/test/e2e/fixtures/edges/edge-line-endings/feature.ts +13 -0
  219. package/test/e2e/fixtures/edges/edge-line-endings/template/digitalExperiences/webApplications/edge-line-endings/src/__prepend__index.tsx +2 -0
  220. package/test/e2e/fixtures/edges/edge-line-endings/template/digitalExperiences/webApplications/edge-line-endings/src/crlf.tsx +4 -0
  221. package/test/e2e/fixtures/edges/edge-line-endings/template/digitalExperiences/webApplications/edge-line-endings/src/placeholder.tsx +0 -0
  222. package/test/e2e/fixtures/edges/edge-line-endings/template/digitalExperiences/webApplications/edge-line-endings/src/styles/__append__global.css +4 -0
  223. package/test/e2e/fixtures/edges/edge-missing-base-files/feature.ts +13 -0
  224. package/test/e2e/fixtures/edges/edge-missing-base-files/template/digitalExperiences/webApplications/edge-missing-base-files/src/__inherit__missing.tsx +1 -0
  225. package/test/e2e/fixtures/edges/edge-missing-base-files/template/digitalExperiences/webApplications/edge-missing-base-files/src/__prepend__nonexistent.tsx +2 -0
  226. package/test/e2e/fixtures/edges/edge-missing-base-files/template/digitalExperiences/webApplications/edge-missing-base-files/src/placeholder.tsx +0 -0
  227. package/test/e2e/fixtures/edges/edge-package-json-conflicts-a/feature.ts +14 -0
  228. package/test/e2e/fixtures/edges/edge-package-json-conflicts-a/template/digitalExperiences/webApplications/edge-package-json-conflicts-a/src/placeholder.tsx +1 -0
  229. package/test/e2e/fixtures/edges/edge-package-json-conflicts-b/feature.ts +14 -0
  230. package/test/e2e/fixtures/edges/edge-package-json-conflicts-b/template/digitalExperiences/webApplications/edge-package-json-conflicts-b/src/placeholder.tsx +1 -0
  231. package/test/e2e/fixtures/edges/edge-performance-many/feature.ts +26 -0
  232. package/test/e2e/fixtures/edges/edge-performance-many/template/digitalExperiences/webApplications/edge-performance-many/src/placeholder.tsx +0 -0
  233. package/test/e2e/fixtures/path-mappings/feature-custom-mapping/feature.ts +16 -0
  234. package/test/e2e/fixtures/path-mappings/feature-custom-mapping/template/web/src/custom-component.tsx +3 -0
  235. package/test/e2e/fixtures/path-mappings/feature-custom-mapping/template/web/src/routes.tsx +8 -0
  236. package/test/e2e/fixtures/path-mappings/feature-mixed-paths/feature.ts +7 -0
  237. package/test/e2e/fixtures/path-mappings/feature-mixed-paths/template/digitalExperiences/webApplications/feature-mixed-paths/assets/icon.svg +3 -0
  238. package/test/e2e/fixtures/path-mappings/feature-mixed-paths/template/webApp/src/mapped-component.tsx +3 -0
  239. package/test/e2e/fixtures/path-mappings/feature-mixed-paths/template/webApp/src/routes.tsx +8 -0
  240. package/test/e2e/fixtures/path-mappings/feature-with-webapp-mapping/feature.ts +7 -0
  241. package/test/e2e/fixtures/path-mappings/feature-with-webapp-mapping/template/webApp/src/app.tsx +3 -0
  242. package/test/e2e/fixtures/path-mappings/feature-with-webapp-mapping/template/webApp/src/routes.tsx +8 -0
  243. package/test/e2e/fixtures/path-mappings/feature-without-mapping/feature.ts +11 -0
  244. package/test/e2e/fixtures/path-mappings/feature-without-mapping/template/digitalExperiences/webApplications/feature-without-mapping/src/legacy-component.tsx +3 -0
  245. package/test/e2e/fixtures/path-mappings/feature-without-mapping/template/digitalExperiences/webApplications/feature-without-mapping/src/routes.tsx +8 -0
  246. package/test/e2e/fixtures/scenarios/scenario-authentication/feature.ts +10 -0
  247. package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/components/LoginForm.tsx +25 -0
  248. package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/context/AuthContext.tsx +28 -0
  249. package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/login.tsx +10 -0
  250. package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/placeholder.tsx +0 -0
  251. package/test/e2e/fixtures/scenarios/scenario-authentication/template/digitalExperiences/webApplications/scenario-authentication/src/routes.tsx +17 -0
  252. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/feature.ts +11 -0
  253. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/__inherit__appLayout.tsx +1 -0
  254. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/components/ContactDetail.tsx +54 -0
  255. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/components/ContactForm.tsx +146 -0
  256. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/components/ContactList.tsx +77 -0
  257. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/placeholder.tsx +0 -0
  258. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/routes.tsx +36 -0
  259. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/styles/__append__global.css +176 -0
  260. package/test/e2e/fixtures/scenarios/scenario-crud-contacts/template/digitalExperiences/webApplications/scenario-crud-contacts/src/utils/contactsApi.ts +42 -0
  261. package/test/e2e/fixtures/scenarios/scenario-navigation-menu/feature.ts +10 -0
  262. package/test/e2e/fixtures/scenarios/scenario-navigation-menu/template/digitalExperiences/webApplications/scenario-navigation-menu/src/__append__appLayout.tsx +4 -0
  263. package/test/e2e/fixtures/scenarios/scenario-navigation-menu/template/digitalExperiences/webApplications/scenario-navigation-menu/src/components/NavigationMenu.tsx +17 -0
  264. package/test/e2e/fixtures/scenarios/scenario-navigation-menu/template/digitalExperiences/webApplications/scenario-navigation-menu/src/placeholder.tsx +0 -0
  265. package/test/e2e/fixtures/single-operations/feature-file-append/feature.ts +10 -0
  266. package/test/e2e/fixtures/single-operations/feature-file-append/template/digitalExperiences/webApplications/feature-file-append/src/styles/__append__global.css +10 -0
  267. package/test/e2e/fixtures/single-operations/feature-file-inherit/feature.ts +10 -0
  268. package/test/e2e/fixtures/single-operations/feature-file-inherit/template/digitalExperiences/webApplications/feature-file-inherit/src/__inherit__appLayout.tsx +1 -0
  269. package/test/e2e/fixtures/single-operations/feature-file-inherit/template/digitalExperiences/webApplications/feature-file-inherit/src/__inherit__home.tsx +1 -0
  270. package/test/e2e/fixtures/single-operations/feature-file-prepend/feature.ts +10 -0
  271. package/test/e2e/fixtures/single-operations/feature-file-prepend/template/digitalExperiences/webApplications/feature-file-prepend/src/__prepend__index.tsx +2 -0
  272. package/test/e2e/fixtures/single-operations/feature-import-merge/feature.ts +10 -0
  273. package/test/e2e/fixtures/single-operations/feature-import-merge/template/digitalExperiences/webApplications/feature-import-merge/src/routes.tsx +18 -0
  274. package/test/e2e/fixtures/single-operations/feature-import-merge/template/digitalExperiences/webApplications/feature-import-merge/src/settings.tsx +8 -0
  275. package/test/e2e/fixtures/single-operations/feature-route-add/feature.ts +10 -0
  276. package/test/e2e/fixtures/single-operations/feature-route-add/template/digitalExperiences/webApplications/feature-route-add/src/about.tsx +8 -0
  277. package/test/e2e/fixtures/single-operations/feature-route-add/template/digitalExperiences/webApplications/feature-route-add/src/routes.tsx +23 -0
  278. package/test/e2e/fixtures/single-operations/feature-route-add/template/digitalExperiences/webApplications/feature-route-add/src/services.tsx +8 -0
  279. package/test/e2e/fixtures/watch/watch-add-delete-files/feature.ts +13 -0
  280. package/test/e2e/fixtures/watch/watch-add-delete-files/template/digitalExperiences/webApplications/watch-add-delete-files/src/initial.tsx +4 -0
  281. package/test/e2e/fixtures/watch/watch-add-delete-files/template/digitalExperiences/webApplications/watch-add-delete-files/src/placeholder.tsx +4 -0
  282. package/test/e2e/fixtures/watch/watch-basic/feature.ts +13 -0
  283. package/test/e2e/fixtures/watch/watch-basic/template/digitalExperiences/webApplications/watch-basic/src/placeholder.tsx +4 -0
  284. package/test/e2e/fixtures/watch/watch-basic/template/digitalExperiences/webApplications/watch-basic/src/watchTest.tsx +3 -0
  285. package/test/e2e/fixtures/watch/watch-debounce/feature.ts +13 -0
  286. package/test/e2e/fixtures/watch/watch-debounce/template/digitalExperiences/webApplications/watch-debounce/src/placeholder.tsx +4 -0
  287. package/test/e2e/fixtures/watch/watch-multiple-files/feature.ts +13 -0
  288. package/test/e2e/fixtures/watch/watch-multiple-files/template/digitalExperiences/webApplications/watch-multiple-files/src/components/WatchComponent.tsx +3 -0
  289. package/test/e2e/fixtures/watch/watch-multiple-files/template/digitalExperiences/webApplications/watch-multiple-files/src/placeholder.tsx +4 -0
  290. package/test/e2e/fixtures/watch/watch-multiple-files/template/digitalExperiences/webApplications/watch-multiple-files/src/styles/theme.css +4 -0
  291. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/package.json +10 -0
  292. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/about.tsx +8 -0
  293. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/appLayout.tsx +27 -0
  294. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/contact.tsx +8 -0
  295. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/home.tsx +8 -0
  296. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/index.tsx +10 -0
  297. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/old-page.tsx +8 -0
  298. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/routes.tsx +35 -0
  299. package/test/e2e/gold/dep-chain-linear-apply/digitalExperiences/webApplications/dep-chain-linear/src/styles/global.css +14 -0
  300. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/package.json +10 -0
  301. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/appLayout.tsx +27 -0
  302. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/home.tsx +8 -0
  303. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/index.tsx +10 -0
  304. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/old-page.tsx +8 -0
  305. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/page-a.tsx +8 -0
  306. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/page-b.tsx +8 -0
  307. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/page-c.tsx +8 -0
  308. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/page-d.tsx +8 -0
  309. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/routes.tsx +47 -0
  310. package/test/e2e/gold/dep-chain-long-apply/digitalExperiences/webApplications/dep-chain-a/src/styles/global.css +14 -0
  311. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/package.json +10 -0
  312. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/admin-dashboard.tsx +1 -0
  313. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/admin-layout.tsx +1 -0
  314. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/analytics.tsx +1 -0
  315. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/appLayout.tsx +27 -0
  316. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/components.tsx +8 -0
  317. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/dashboard.tsx +8 -0
  318. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/home.tsx +8 -0
  319. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/index.tsx +10 -0
  320. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/login.tsx +8 -0
  321. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/profile-edit.tsx +1 -0
  322. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/profile.tsx +8 -0
  323. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/reports.tsx +1 -0
  324. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/routes.tsx +94 -0
  325. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/signup.tsx +1 -0
  326. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/styles/global.css +14 -0
  327. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/tools.tsx +1 -0
  328. package/test/e2e/gold/dep-complex-graph-apply/digitalExperiences/webApplications/dep-complex-graph/src/types.tsx +8 -0
  329. package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/package.json +10 -0
  330. package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/appLayout.tsx +27 -0
  331. package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/custom-component.tsx +3 -0
  332. package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/home.tsx +8 -0
  333. package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/index.tsx +10 -0
  334. package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/old-page.tsx +8 -0
  335. package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/routes.tsx +28 -0
  336. package/test/e2e/gold/feature-custom-mapping-apply/digitalExperiences/webApplications/feature-custom-mapping/src/styles/global.css +14 -0
  337. package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/package.json +10 -0
  338. package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/about.tsx +8 -0
  339. package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/appLayout.tsx +27 -0
  340. package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/home.tsx +8 -0
  341. package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/index.tsx +10 -0
  342. package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/old-page.tsx +8 -0
  343. package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/routes.tsx +29 -0
  344. package/test/e2e/gold/feature-file-inherit-route-add-apply/digitalExperiences/webApplications/feature-file-inherit-route-add/src/styles/global.css +14 -0
  345. package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/package.json +10 -0
  346. package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/appLayout.tsx +27 -0
  347. package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/home.tsx +8 -0
  348. package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/index.tsx +13 -0
  349. package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/old-page.tsx +8 -0
  350. package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/routes.tsx +29 -0
  351. package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/settings.tsx +9 -0
  352. package/test/e2e/gold/feature-file-prepend-append-apply/digitalExperiences/webApplications/feature-file-prepend-append/src/styles/global.css +25 -0
  353. package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/package.json +10 -0
  354. package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/appLayout.tsx +27 -0
  355. package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/home.tsx +8 -0
  356. package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/index.tsx +10 -0
  357. package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/routes.tsx +17 -0
  358. package/test/e2e/gold/feature-file-route-delete-apply/digitalExperiences/webApplications/feature-file-route-delete/src/styles/global.css +14 -0
  359. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/assets/icon.svg +3 -0
  360. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/package.json +10 -0
  361. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/appLayout.tsx +27 -0
  362. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/home.tsx +8 -0
  363. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/index.tsx +10 -0
  364. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/mapped-component.tsx +3 -0
  365. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/old-page.tsx +8 -0
  366. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/routes.tsx +28 -0
  367. package/test/e2e/gold/feature-mixed-paths-apply/digitalExperiences/webApplications/feature-mixed-paths/src/styles/global.css +14 -0
  368. package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/package.json +10 -0
  369. package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/app.tsx +3 -0
  370. package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/appLayout.tsx +27 -0
  371. package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/home.tsx +8 -0
  372. package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/index.tsx +10 -0
  373. package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/old-page.tsx +8 -0
  374. package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/routes.tsx +28 -0
  375. package/test/e2e/gold/feature-with-webapp-mapping-apply/digitalExperiences/webApplications/feature-with-webapp-mapping/src/styles/global.css +14 -0
  376. package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/package.json +10 -0
  377. package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/appLayout.tsx +27 -0
  378. package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/home.tsx +8 -0
  379. package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/index.tsx +10 -0
  380. package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/legacy-component.tsx +3 -0
  381. package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/old-page.tsx +8 -0
  382. package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/routes.tsx +28 -0
  383. package/test/e2e/gold/feature-without-mapping-apply/digitalExperiences/webApplications/feature-without-mapping/src/styles/global.css +14 -0
  384. package/test/e2e/path-mappings.spec.ts +232 -0
  385. package/test/e2e/watch-patches.spec.ts +237 -0
  386. package/test/helpers/cli-runner.ts +100 -0
  387. package/test/helpers/compare-directories.ts +197 -0
  388. package/test/helpers/create-temp-dir.ts +34 -0
  389. package/test/helpers/fixtures.ts +67 -0
  390. package/test/setup.ts +6 -0
  391. package/test/unit/debounce.spec.ts +159 -0
  392. package/test/unit/dependency-resolver.spec.ts +260 -0
  393. package/test/unit/file-operations.spec.ts +264 -0
  394. package/test/unit/import-merger.spec.ts +395 -0
  395. package/test/unit/index.spec.ts +158 -0
  396. package/test/unit/new-app.spec.ts +178 -0
  397. package/test/unit/new-feature.spec.ts +178 -0
  398. package/test/unit/package-json-merger.spec.ts +275 -0
  399. package/test/unit/patch-loader.spec.ts +238 -0
  400. package/test/unit/path-mappings.spec.ts +241 -0
  401. package/test/unit/paths.spec.ts +247 -0
  402. package/test/unit/route-merger.spec.ts +265 -0
  403. package/test/unit/validation.spec.ts +311 -0
  404. package/tsconfig.json +20 -0
  405. package/vitest.config.ts +18 -0
@@ -0,0 +1,201 @@
1
+ import { readFileSync, existsSync, mkdirSync, writeFileSync, rmSync, statSync } from 'fs';
2
+ import { dirname, extname } from 'path';
3
+ import { mergeRoutes } from '../utils/route-merger.js';
4
+ import * as logger from '../utils/logger.js';
5
+ const INHERIT_PREFIX = '__inherit__';
6
+ export class FileOperationError extends Error {
7
+ constructor(message) {
8
+ super(message);
9
+ this.name = 'FileOperationError';
10
+ }
11
+ }
12
+ /**
13
+ * Fix import paths by removing __inherit__ prefix from import/require statements
14
+ *
15
+ * Examples:
16
+ * - import { x } from './__inherit__routes' -> import { x } from './routes'
17
+ * - import x from '../__inherit__routes.tsx' -> import x from '../routes.tsx'
18
+ * - require('./__inherit__file') -> require('./file')
19
+ *
20
+ * @param content - File content to process
21
+ * @returns Content with fixed import paths
22
+ */
23
+ function fixInheritImportPaths(content) {
24
+ // Match import/export statements with __inherit__ in the path
25
+ // Handles: import ... from '...__inherit__...'
26
+ // export ... from '...__inherit__...'
27
+ // import('...__inherit__...')
28
+ // require('...__inherit__...')
29
+ // Pattern explanation:
30
+ // (from\s+|import\(|require\() - matches 'from ', 'import(', or 'require('
31
+ // (['"`]) - captures opening quote
32
+ // ([^'"`]*) - captures path before __inherit__
33
+ // __inherit__ - the prefix to remove
34
+ // ([^'"`]*) - captures rest of path
35
+ // \2 - matches same quote type as opening
36
+ return content.replace(/(from\s+|import\(|require\()(['"`])([^'"`]*)__inherit__([^'"`]*)\2/g, (match, prefix, quote, before, after) => {
37
+ return `${prefix}${quote}${before}${after}${quote}`;
38
+ });
39
+ }
40
+ /**
41
+ * Check if file is a JS/TS file that may contain imports
42
+ */
43
+ function isJavaScriptFile(filePath) {
44
+ const ext = extname(filePath);
45
+ return ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'].includes(ext);
46
+ }
47
+ /**
48
+ * Apply a file from patch to target, optionally merging with base
49
+ *
50
+ * @param patchFilePath - Full path to the patch file from the feature
51
+ * @param baseFilePath - Full path to the original base app file (used for merging)
52
+ * @param targetFilePath - Full path to where the result should be written
53
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/routes.tsx")
54
+ * @param shouldMerge - If true, merges patch with base using route merge strategy
55
+ */
56
+ export async function applyFile(patchFilePath, baseFilePath, targetFilePath, relativeTargetPath, shouldMerge = false) {
57
+ if (!existsSync(patchFilePath)) {
58
+ throw new FileOperationError(`Patch file not found: ${patchFilePath}`);
59
+ }
60
+ // Read the patch content
61
+ let patchContent = readFileSync(patchFilePath, 'utf-8');
62
+ // Fix __inherit__ import paths for JS/TS files
63
+ if (isJavaScriptFile(patchFilePath)) {
64
+ patchContent = fixInheritImportPaths(patchContent);
65
+ }
66
+ if (shouldMerge) {
67
+ // Merge strategy - merge patch with base, write to target
68
+ if (!existsSync(baseFilePath)) {
69
+ throw new FileOperationError(`Base file not found: ${baseFilePath}. Merge requires base file to exist.`);
70
+ }
71
+ // Merge patch with base (note: mergeRoutes reads files internally, so we write fixed content to temp)
72
+ let mergedContent = mergeRoutes(patchFilePath, baseFilePath);
73
+ // Fix imports in merged content
74
+ if (isJavaScriptFile(targetFilePath)) {
75
+ mergedContent = fixInheritImportPaths(mergedContent);
76
+ }
77
+ // Check if target already has this content
78
+ if (existsSync(targetFilePath)) {
79
+ const existingContent = readFileSync(targetFilePath, 'utf-8');
80
+ if (existingContent === mergedContent) {
81
+ logger.info(`Skipped ${relativeTargetPath} (content unchanged after merge)`);
82
+ return;
83
+ }
84
+ }
85
+ // Ensure target directory exists
86
+ const targetDirPath = dirname(targetFilePath);
87
+ if (!existsSync(targetDirPath)) {
88
+ mkdirSync(targetDirPath, { recursive: true });
89
+ }
90
+ writeFileSync(targetFilePath, mergedContent, 'utf-8');
91
+ logger.success(`Merged ${relativeTargetPath}`);
92
+ }
93
+ else {
94
+ // Add/Update strategy - copy patch to target
95
+ const targetExists = existsSync(targetFilePath);
96
+ if (targetExists) {
97
+ const existingContent = readFileSync(targetFilePath, 'utf-8');
98
+ if (existingContent === patchContent) {
99
+ logger.info(`Skipped ${relativeTargetPath} (content unchanged)`);
100
+ return;
101
+ }
102
+ }
103
+ // Ensure target directory exists
104
+ const targetDirPath = dirname(targetFilePath);
105
+ if (!existsSync(targetDirPath)) {
106
+ mkdirSync(targetDirPath, { recursive: true });
107
+ }
108
+ // Write the file
109
+ writeFileSync(targetFilePath, patchContent, 'utf-8');
110
+ if (targetExists) {
111
+ logger.success(`Updated ${relativeTargetPath}`);
112
+ }
113
+ else {
114
+ logger.success(`Added ${relativeTargetPath}`);
115
+ }
116
+ }
117
+ }
118
+ /**
119
+ * Delete a file or directory from the target app
120
+ *
121
+ * @param targetFilePath - Full path to the file/directory to delete
122
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/routes.tsx")
123
+ */
124
+ export async function deleteFile(targetFilePath, relativeTargetPath) {
125
+ if (!existsSync(targetFilePath)) {
126
+ logger.info(`Skipped deleting ${relativeTargetPath} (does not exist)`);
127
+ return;
128
+ }
129
+ const stat = statSync(targetFilePath);
130
+ if (stat.isDirectory()) {
131
+ rmSync(targetFilePath, { recursive: true, force: true });
132
+ logger.success(`Deleted directory ${relativeTargetPath}`);
133
+ }
134
+ else {
135
+ rmSync(targetFilePath, { force: true });
136
+ logger.success(`Deleted ${relativeTargetPath}`);
137
+ }
138
+ }
139
+ /**
140
+ * Prepend content from a feature file to the beginning of a target file
141
+ *
142
+ * @param featureFilePath - Full path to the feature file with content to prepend
143
+ * @param targetFilePath - Full path to the target file to prepend to
144
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/styles/global.css")
145
+ */
146
+ export async function prependToFile(featureFilePath, targetFilePath, relativeTargetPath) {
147
+ if (!existsSync(featureFilePath)) {
148
+ throw new FileOperationError(`Feature file not found: ${featureFilePath}`);
149
+ }
150
+ if (!existsSync(targetFilePath)) {
151
+ throw new FileOperationError(`Target file not found: ${targetFilePath}`);
152
+ }
153
+ // Read both files
154
+ let featureContent = readFileSync(featureFilePath, 'utf-8');
155
+ const targetContent = readFileSync(targetFilePath, 'utf-8');
156
+ // Fix __inherit__ imports in feature content if it's a JS/TS file
157
+ if (isJavaScriptFile(featureFilePath)) {
158
+ featureContent = fixInheritImportPaths(featureContent);
159
+ }
160
+ // Prepend feature content to target content
161
+ const newContent = featureContent + '\n' + targetContent;
162
+ // Check if content would actually change
163
+ if (targetContent === newContent) {
164
+ logger.info(`Skipped ${relativeTargetPath} (content unchanged after prepend)`);
165
+ return;
166
+ }
167
+ writeFileSync(targetFilePath, newContent, 'utf-8');
168
+ logger.success(`Prepended to ${relativeTargetPath}`);
169
+ }
170
+ /**
171
+ * Append content from a feature file to the end of a target file
172
+ *
173
+ * @param featureFilePath - Full path to the feature file with content to append
174
+ * @param targetFilePath - Full path to the target file to append to
175
+ * @param relativeTargetPath - Relative path for logging (e.g. "src/styles/global.css")
176
+ */
177
+ export async function appendToFile(featureFilePath, targetFilePath, relativeTargetPath) {
178
+ if (!existsSync(featureFilePath)) {
179
+ throw new FileOperationError(`Feature file not found: ${featureFilePath}`);
180
+ }
181
+ if (!existsSync(targetFilePath)) {
182
+ throw new FileOperationError(`Target file not found: ${targetFilePath}`);
183
+ }
184
+ // Read both files
185
+ const targetContent = readFileSync(targetFilePath, 'utf-8');
186
+ let featureContent = readFileSync(featureFilePath, 'utf-8');
187
+ // Fix __inherit__ imports in feature content if it's a JS/TS file
188
+ if (isJavaScriptFile(featureFilePath)) {
189
+ featureContent = fixInheritImportPaths(featureContent);
190
+ }
191
+ // Append feature content to target content
192
+ const newContent = targetContent + '\n' + featureContent;
193
+ // Check if content would actually change
194
+ if (targetContent === newContent) {
195
+ logger.info(`Skipped ${relativeTargetPath} (content unchanged after append)`);
196
+ return;
197
+ }
198
+ writeFileSync(targetFilePath, newContent, 'utf-8');
199
+ logger.success(`Appended to ${relativeTargetPath}`);
200
+ }
201
+ //# sourceMappingURL=file-operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-operations.js","sourceRoot":"","sources":["../../src/core/file-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC1F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,MAAM,MAAM,oBAAoB,CAAC;AAE7C,MAAM,cAA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B,EACtB,kBAA0B;IAE1B,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,kBAAkB,CAC1B,2BAA2B,eAAe,EAAE,CAC7C,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,kBAAkB,CAC1B,0BAA0B,cAAc,EAAE,CAC3C,CAAC;IACJ,CAAC;IAED,kBAAkB;IAClB,MAAM,aAAa,GAAG,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC5D,IAAI,cAAc,GAAG,YAAY,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAE5D,kEAAkE;IAClE,IAAI,gBAAgB,CAAC,eAAe,CAAC,EAAE,CAAC;QACtC,cAAc,GAAG,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACzD,CAAC;IAED,2CAA2C;IAC3C,MAAM,UAAU,GAAG,aAAa,GAAG,IAAI,GAAG,cAAc,CAAC;IAEzD,yCAAyC;IACzC,IAAI,aAAa,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,CAAC,IAAI,CAAC,WAAW,kBAAkB,mCAAmC,CAAC,CAAC;QAC9E,OAAO;IACT,CAAC;IAED,aAAa,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACnD,MAAM,CAAC,OAAO,CAAC,eAAe,kBAAkB,EAAE,CAAC,CAAC;AACtD,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { PackageJsonDependencies } from '../types.js';
2
+ export declare class PackageJsonMergeError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ /**
6
+ * Build package specs array from dependencies object
7
+ * @param dependencies - Object mapping package names to versions
8
+ * @returns Array of package specs in format "package@version"
9
+ */
10
+ export declare function buildPackageSpecs(dependencies: Record<string, string>): string[];
11
+ /**
12
+ * Build yarn command for package specs
13
+ * @param packageSpecs - Array of package specs
14
+ * @param isDev - Whether these are dev dependencies
15
+ * @returns yarn command string
16
+ */
17
+ export declare function buildInstallCommand(packageSpecs: string[], isDev: boolean): string;
18
+ /**
19
+ * Execute yarn command (extracted for testability)
20
+ * @param command - yarn command to execute
21
+ * @param cwd - Working directory
22
+ */
23
+ export declare function executeNpmInstall(command: string, cwd: string): void;
24
+ /**
25
+ * Install dependencies using yarn
26
+ * @param targetDir - Base directory containing digitalExperiences/webApplications/<app-name>, or direct path to web app directory if webAppDirPath is provided
27
+ * @param webAppDirPath - Optional direct path to the web application directory
28
+ */
29
+ export declare function mergePackageJson(targetDir: string, patchDependencies: PackageJsonDependencies, webAppDirPath?: string): Promise<string[]>;
30
+ //# sourceMappingURL=package-json-merger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json-merger.d.ts","sourceRoot":"","sources":["../../src/core/package-json-merger.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAI3D,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAEhF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAGlF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAKpE;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,uBAAuB,EAC1C,aAAa,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,EAAE,CAAC,CAyEnB"}
@@ -0,0 +1,104 @@
1
+ import { existsSync } from 'fs';
2
+ import { join } from 'path';
3
+ import { execSync } from 'child_process';
4
+ import * as logger from '../utils/logger.js';
5
+ import { getWebApplicationPath } from '../utils/validation.js';
6
+ export class PackageJsonMergeError extends Error {
7
+ constructor(message) {
8
+ super(message);
9
+ this.name = 'PackageJsonMergeError';
10
+ }
11
+ }
12
+ /**
13
+ * Build package specs array from dependencies object
14
+ * @param dependencies - Object mapping package names to versions
15
+ * @returns Array of package specs in format "package@version"
16
+ */
17
+ export function buildPackageSpecs(dependencies) {
18
+ return Object.entries(dependencies).map(([name, version]) => `${name}@${version}`);
19
+ }
20
+ /**
21
+ * Build yarn command for package specs
22
+ * @param packageSpecs - Array of package specs
23
+ * @param isDev - Whether these are dev dependencies
24
+ * @returns yarn command string
25
+ */
26
+ export function buildInstallCommand(packageSpecs, isDev) {
27
+ const devFlag = isDev ? '--dev ' : '';
28
+ return `yarn ${devFlag}${packageSpecs.join(' ')}`;
29
+ }
30
+ /**
31
+ * Execute yarn command (extracted for testability)
32
+ * @param command - yarn command to execute
33
+ * @param cwd - Working directory
34
+ */
35
+ export function executeNpmInstall(command, cwd) {
36
+ execSync(command, {
37
+ cwd,
38
+ stdio: 'inherit'
39
+ });
40
+ }
41
+ /**
42
+ * Install dependencies using yarn
43
+ * @param targetDir - Base directory containing digitalExperiences/webApplications/<app-name>, or direct path to web app directory if webAppDirPath is provided
44
+ * @param webAppDirPath - Optional direct path to the web application directory
45
+ */
46
+ export async function mergePackageJson(targetDir, patchDependencies, webAppDirPath) {
47
+ // Get the web application directory where package.json is located
48
+ const webAppDir = webAppDirPath || getWebApplicationPath(targetDir);
49
+ const packageJsonPath = join(webAppDir, 'package.json');
50
+ if (!existsSync(packageJsonPath)) {
51
+ throw new PackageJsonMergeError(`package.json not found at '${packageJsonPath}'. Expected structure: digitalExperiences/webApplications/<app-name>`);
52
+ }
53
+ try {
54
+ const changes = [];
55
+ // Install dependencies
56
+ if (patchDependencies.dependencies) {
57
+ const packages = Object.entries(patchDependencies.dependencies);
58
+ if (packages.length > 0) {
59
+ logger.info(`Installing ${packages.length} dependency/dependencies...`);
60
+ const packageSpecs = buildPackageSpecs(patchDependencies.dependencies);
61
+ packageSpecs.forEach(spec => logger.info(` ${spec}`));
62
+ try {
63
+ const command = buildInstallCommand(packageSpecs, false);
64
+ executeNpmInstall(command, webAppDir);
65
+ changes.push(...packageSpecs);
66
+ }
67
+ catch (err) {
68
+ throw new PackageJsonMergeError(`Failed to install dependencies: ${err instanceof Error ? err.message : String(err)}`);
69
+ }
70
+ }
71
+ }
72
+ // Install devDependencies
73
+ if (patchDependencies.devDependencies) {
74
+ const packages = Object.entries(patchDependencies.devDependencies);
75
+ if (packages.length > 0) {
76
+ logger.info(`Installing ${packages.length} dev dependency/dependencies...`);
77
+ const packageSpecs = buildPackageSpecs(patchDependencies.devDependencies);
78
+ packageSpecs.forEach(spec => logger.info(` ${spec}`));
79
+ try {
80
+ const command = buildInstallCommand(packageSpecs, true);
81
+ executeNpmInstall(command, webAppDir);
82
+ changes.push(...packageSpecs.map(spec => `${spec} (dev)`));
83
+ }
84
+ catch (err) {
85
+ throw new PackageJsonMergeError(`Failed to install dev dependencies: ${err instanceof Error ? err.message : String(err)}`);
86
+ }
87
+ }
88
+ }
89
+ if (changes.length > 0) {
90
+ logger.success(`Installed ${changes.length} dependency change(s)`);
91
+ }
92
+ else {
93
+ logger.info('No new dependencies to install');
94
+ }
95
+ return changes;
96
+ }
97
+ catch (err) {
98
+ if (err instanceof PackageJsonMergeError) {
99
+ throw err;
100
+ }
101
+ throw new PackageJsonMergeError(`Failed to install dependencies: ${err instanceof Error ? err.message : String(err)}`);
102
+ }
103
+ }
104
+ //# sourceMappingURL=package-json-merger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package-json-merger.js","sourceRoot":"","sources":["../../src/core/package-json-merger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,M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CACtF,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Feature, PathMappings } from '../types.js';
2
+ export declare class FeatureLoadError extends Error {
3
+ constructor(message: string);
4
+ }
5
+ export type FeatureConfig = {
6
+ features: Feature[];
7
+ templateDir: string;
8
+ webAppName: string;
9
+ routeFilePath: string;
10
+ dependencies: string[];
11
+ pathMappings: PathMappings;
12
+ };
13
+ /**
14
+ * Load features from a feature's feature.ts file
15
+ */
16
+ export declare function loadFeature(featurePath: string): Promise<FeatureConfig>;
17
+ //# sourceMappingURL=patch-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-loader.d.ts","sourceRoot":"","sources":["../../src/core/patch-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,qBAAa,gBAAiB,SAAQ,KAAK;gBAC7B,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAcF;;GAEG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CA2F7E"}
@@ -0,0 +1,100 @@
1
+ import { existsSync } from 'fs';
2
+ import { join } from 'path';
3
+ import { pathToFileURL } from 'url';
4
+ export class FeatureLoadError extends Error {
5
+ constructor(message) {
6
+ super(message);
7
+ this.name = 'FeatureLoadError';
8
+ }
9
+ }
10
+ /**
11
+ * Extract feature name from feature path
12
+ * Examples:
13
+ * - 'packages/feature-navigation-menu' -> 'feature-navigation-menu'
14
+ * - '/absolute/path/to/feature-name' -> 'feature-name'
15
+ * - 'packages/reference-app-vibe-coding-starter' -> 'reference-app-vibe-coding-starter'
16
+ */
17
+ function extractFeatureName(featurePath) {
18
+ const parts = featurePath.split('/');
19
+ return parts[parts.length - 1];
20
+ }
21
+ /**
22
+ * Load features from a feature's feature.ts file
23
+ */
24
+ export async function loadFeature(featurePath) {
25
+ const featureFilePath = join(featurePath, 'feature.ts');
26
+ if (!existsSync(featureFilePath)) {
27
+ throw new FeatureLoadError(`No feature.ts found in feature path '${featurePath}'`);
28
+ }
29
+ try {
30
+ // Convert to file URL for dynamic import
31
+ const featurePathUrl = pathToFileURL(featureFilePath).href;
32
+ const module = await import(featurePathUrl);
33
+ // Require default export
34
+ if (!module.default) {
35
+ throw new FeatureLoadError(`feature.ts must have a default export (array or object) in ${featureFilePath}`);
36
+ }
37
+ // Helper to check if a value looks like a feature object
38
+ const isFeatureLike = (value) => {
39
+ return value && typeof value === 'object' && !Array.isArray(value);
40
+ };
41
+ let features;
42
+ if (Array.isArray(module.default)) {
43
+ features = module.default;
44
+ }
45
+ else if (isFeatureLike(module.default)) {
46
+ features = [module.default];
47
+ }
48
+ else {
49
+ throw new FeatureLoadError(`Default export must be a Feature object or Feature[] array in ${featureFilePath}`);
50
+ }
51
+ // Extract feature name from path for constructing defaults
52
+ const featureName = extractFeatureName(featurePath);
53
+ // Extract configuration from features (with defaults)
54
+ let templateDir = 'template';
55
+ let webAppName = featureName; // Default to feature name
56
+ let routeFilePath;
57
+ let dependencies = [];
58
+ let pathMappings = {}; // Default: enabled with no custom mappings
59
+ // Check if any feature specifies custom configuration
60
+ for (const feature of features) {
61
+ if (feature.templateDir) {
62
+ templateDir = feature.templateDir;
63
+ }
64
+ if (feature.webAppName) {
65
+ webAppName = feature.webAppName;
66
+ }
67
+ if (feature.routeFilePath) {
68
+ routeFilePath = feature.routeFilePath;
69
+ }
70
+ if (feature.dependencies) {
71
+ // Merge dependencies from all features
72
+ dependencies = [...new Set([...dependencies, ...feature.dependencies])];
73
+ }
74
+ if (feature.pathMappings) {
75
+ // If any feature specifies pathMappings, use it
76
+ // Last one wins if multiple features specify it
77
+ pathMappings = feature.pathMappings;
78
+ }
79
+ }
80
+ // Set default routeFilePath if not explicitly provided
81
+ if (!routeFilePath) {
82
+ routeFilePath = `digitalExperiences/webApplications/${webAppName}/src/routes.tsx`;
83
+ }
84
+ return {
85
+ features,
86
+ templateDir,
87
+ webAppName,
88
+ routeFilePath,
89
+ dependencies,
90
+ pathMappings
91
+ };
92
+ }
93
+ catch (err) {
94
+ if (err instanceof FeatureLoadError) {
95
+ throw err;
96
+ }
97
+ throw new FeatureLoadError(`Failed to load feature from ${featureFilePath}: ${err instanceof Error ? err.message : String(err)}`);
98
+ }
99
+ }
100
+ //# sourceMappingURL=patch-loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patch-loader.js","sourceRoot":"","sources":["../../src/core/patch-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAGpC,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAWD;;;;;;GAMG;AACH,SAAS,kBAAkB,CAAC,WAAmB;IAC7C,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,WAAmB;IACnD,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAExD,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,C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{};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { applyPatchesCommand } from './commands/apply-patches.js';
4
+ import { watchPatchesCommand } from './commands/watch-patches.js';
5
+ import { readFileSync } from 'fs';
6
+ import { join, dirname } from 'path';
7
+ import { fileURLToPath } from 'url';
8
+ import { newAppOrFeatureCommand } from './commands/new-app-feature.js';
9
+ // Get package.json for version info
10
+ const __dirname = dirname(fileURLToPath(import.meta.url));
11
+ const packageJsonPath = join(__dirname, '../package.json');
12
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
13
+ const program = new Command();
14
+ program
15
+ .name('apply-patches')
16
+ .description('CLI tool for applying feature patches to base apps')
17
+ .version(packageJson.version);
18
+ program
19
+ .command('apply-patches')
20
+ .description('Apply feature patches to an app')
21
+ .argument('<feature-path>', 'Path to the feature (e.g., packages/feature-navigation-menu)')
22
+ .argument('<app-path>', 'Path to the app (e.g., packages/base-react-app or my-app)')
23
+ .argument('<target-dir>', 'Target directory to copy app to before applying patches')
24
+ .option('--skip-dependency-changes', 'Skip installing dependencies from package.json')
25
+ .option('--clean', 'Remove target directory if it exists before applying patches')
26
+ .action(async (featurePath, appPath, targetDir, options) => {
27
+ try {
28
+ await applyPatchesCommand(featurePath, appPath, {
29
+ targetDirName: targetDir,
30
+ skipDependencyChanges: options.skipDependencyChanges,
31
+ clean: options.clean
32
+ });
33
+ process.exit(0);
34
+ }
35
+ catch (err) {
36
+ process.exit(1);
37
+ }
38
+ });
39
+ program
40
+ .command('watch-patches')
41
+ .description('Watch feature template directory and auto-apply patches on changes')
42
+ .argument('<feature-path>', 'Path to the feature (e.g., packages/feature-navigation-menu)')
43
+ .argument('<app-path>', 'Path to the app (e.g., packages/base-react-app or my-app)')
44
+ .argument('<target-dir>', 'Target directory to apply patches to')
45
+ .option('--clean', 'Remove target directory if it exists before applying patches')
46
+ .action(async (featurePath, appPath, targetDir, options) => {
47
+ try {
48
+ await watchPatchesCommand(featurePath, appPath, targetDir, options);
49
+ }
50
+ catch (err) {
51
+ process.exit(1);
52
+ }
53
+ });
54
+ program
55
+ .command('new-feature')
56
+ .description('Create a new feature package from the base-feature template')
57
+ .argument('<feature-name>', 'Name of the feature (will be prefixed with "feature-")')
58
+ .action(async (featureName) => {
59
+ try {
60
+ await newAppOrFeatureCommand(featureName, 'feature');
61
+ process.exit(0);
62
+ }
63
+ catch (err) {
64
+ process.exit(1);
65
+ }
66
+ });
67
+ program
68
+ .command('new-app')
69
+ .description('Create a new reference app package from the base-reference-app template')
70
+ .argument('<app-name>', 'Name of the app (will be prefixed with "app-")')
71
+ .action(async (appName) => {
72
+ try {
73
+ await newAppOrFeatureCommand(appName, 'app');
74
+ process.exit(0);
75
+ }
76
+ catch (err) {
77
+ process.exit(1);
78
+ }
79
+ });
80
+ // If no command specified, default to apply-patches
81
+ if (process.argv.length > 2 && !process.argv[2].startsWith('-')) {
82
+ // If first argument is not a recognized command, treat as apply-patches command
83
+ const args = process.argv.slice(2);
84
+ const knownCommands = ['apply-patches', 'watch-patches', 'new-feature', 'new-app'];
85
+ if (!knownCommands.includes(args[0]) && !args[0].startsWith('-')) {
86
+ process.argv.splice(2, 0, 'apply-patches');
87
+ }
88
+ }
89
+ program.parse(process.argv);
90
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EA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ACxE,MAAM,CAAC,KAAK,EAAE,OAAe,EAAE,EAAE;IAChC,IAAI,CAAC;QACH,MAAM,sBAAsB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,oDAAoD;AACpD,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;IAChE,gFAAgF;IAChF,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,aAAa,GAAG,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;IACnF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACjE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC;AAED,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ export type PackageJsonDependencies = {
2
+ dependencies?: Record<string, string>;
3
+ devDependencies?: Record<string, string>;
4
+ };
5
+ export type PathMapping = {
6
+ from: string;
7
+ to: string;
8
+ };
9
+ export type PathMappings = {
10
+ mappings?: PathMapping[];
11
+ enabled?: boolean;
12
+ };
13
+ export type Feature = {
14
+ templateDir?: string;
15
+ webAppName?: string;
16
+ routeFilePath?: string;
17
+ packageJson?: PackageJsonDependencies;
18
+ dependencies?: string[];
19
+ pathMappings?: PathMappings;
20
+ };
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B,CAAA"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Creates a debounced function that delays invoking func until after wait milliseconds
3
+ * have elapsed since the last time the debounced function was invoked.
4
+ */
5
+ export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): (...args: Parameters<T>) => void;
6
+ //# sourceMappingURL=debounce.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debounce.d.ts","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,MAAM,GACX,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAelC"}