@webiny/project 0.0.0-unstable.a4f3e4ea8b → 0.0.0-unstable.a85ef555b2

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 (230) hide show
  1. package/ProjectSdk.d.ts +6 -5
  2. package/ProjectSdk.js +10 -6
  3. package/ProjectSdk.js.map +1 -1
  4. package/abstractions/features/DeployApp.d.ts +2 -2
  5. package/abstractions/features/DeployApp.js.map +1 -1
  6. package/abstractions/features/DestroyApp.d.ts +2 -2
  7. package/abstractions/features/DestroyApp.js.map +1 -1
  8. package/abstractions/features/GetAppOutput.d.ts +2 -2
  9. package/abstractions/features/GetAppOutput.js.map +1 -1
  10. package/abstractions/features/GetAppStackOutput.d.ts +3 -2
  11. package/abstractions/features/GetAppStackOutput.js.map +1 -1
  12. package/abstractions/features/RefreshApp.d.ts +2 -2
  13. package/abstractions/features/RefreshApp.js.map +1 -1
  14. package/abstractions/features/RunPulumiCommand.d.ts +2 -2
  15. package/abstractions/features/RunPulumiCommand.js.map +1 -1
  16. package/abstractions/features/Serve.d.ts +27 -0
  17. package/abstractions/features/Serve.js +5 -0
  18. package/abstractions/features/Serve.js.map +1 -0
  19. package/abstractions/features/Watch.d.ts +10 -0
  20. package/abstractions/features/Watch.js.map +1 -1
  21. package/abstractions/features/index.d.ts +1 -0
  22. package/abstractions/features/index.js +1 -0
  23. package/components/FeatureFlag.d.ts +43 -0
  24. package/components/FeatureFlag.js +60 -0
  25. package/components/FeatureFlag.js.map +1 -0
  26. package/createProjectSdkContainer.d.ts +1 -1
  27. package/createProjectSdkContainer.js +28 -41
  28. package/createProjectSdkContainer.js.map +1 -1
  29. package/decorators/DestroyAppClearStackOutputCache.d.ts +1 -1
  30. package/decorators/GetFeatureFlagsWithLicense.d.ts +0 -1
  31. package/decorators/GetFeatureFlagsWithLicense.js +28 -20
  32. package/decorators/GetFeatureFlagsWithLicense.js.map +1 -1
  33. package/extensions/AdminApiUrl.d.ts +10 -0
  34. package/extensions/AdminApiUrl.js +21 -0
  35. package/extensions/AdminApiUrl.js.map +1 -0
  36. package/extensions/AdminExtension.d.ts +1 -1
  37. package/extensions/AdminExtension.js +3 -3
  38. package/extensions/AdminExtension.js.map +1 -1
  39. package/extensions/AdminWebsocketsUrl.d.ts +12 -0
  40. package/extensions/AdminWebsocketsUrl.js +21 -0
  41. package/extensions/AdminWebsocketsUrl.js.map +1 -0
  42. package/extensions/ApiBuildParam.js +6 -4
  43. package/extensions/ApiBuildParam.js.map +1 -1
  44. package/extensions/ApiExtension.d.ts +1 -1
  45. package/extensions/ApiExtension.js +7 -5
  46. package/extensions/ApiExtension.js.map +1 -1
  47. package/extensions/BugReporter.d.ts +6 -0
  48. package/extensions/BugReporter.js +33 -0
  49. package/extensions/BugReporter.js.map +1 -0
  50. package/extensions/FeatureFlags.d.ts +22 -17
  51. package/extensions/FeatureFlags.js +23 -8
  52. package/extensions/FeatureFlags.js.map +1 -1
  53. package/extensions/Project/SetAdminAppEnvVarsBeforeBuild.js +1 -0
  54. package/extensions/Project/SetAdminAppEnvVarsBeforeBuild.js.map +1 -1
  55. package/extensions/Project/SetAdminAppEnvVarsBeforeWatch.js +1 -0
  56. package/extensions/Project/SetAdminAppEnvVarsBeforeWatch.js.map +1 -1
  57. package/extensions/Project/ShowConfigChangeInfoBeforeAdminWatch.js +2 -1
  58. package/extensions/Project/ShowConfigChangeInfoBeforeAdminWatch.js.map +1 -1
  59. package/extensions/Project/ShowConfigChangeInfoBeforeApiWatch.js +2 -1
  60. package/extensions/Project/ShowConfigChangeInfoBeforeApiWatch.js.map +1 -1
  61. package/extensions/Project/WcpInjectTelemetryClientAfterBuild.js +2 -1
  62. package/extensions/Project/WcpInjectTelemetryClientAfterBuild.js.map +1 -1
  63. package/extensions/Project/showConfigChangeNotice.d.ts +7 -0
  64. package/extensions/Project/showConfigChangeNotice.js +9 -0
  65. package/extensions/Project/showConfigChangeNotice.js.map +1 -0
  66. package/extensions/Project.js +1 -17
  67. package/extensions/Project.js.map +1 -1
  68. package/extensions/hasDefaultExport.d.ts +2 -0
  69. package/extensions/hasDefaultExport.js +17 -0
  70. package/extensions/hasDefaultExport.js.map +1 -0
  71. package/extensions/index.d.ts +67 -35
  72. package/extensions/index.js +12 -2
  73. package/extensions/index.js.map +1 -1
  74. package/extensions/infra/Encryption.d.ts +10 -0
  75. package/extensions/infra/Encryption.js +36 -0
  76. package/extensions/infra/Encryption.js.map +1 -0
  77. package/extensions/infra/Hashing.d.ts +5 -0
  78. package/extensions/infra/Hashing.js +27 -0
  79. package/extensions/infra/Hashing.js.map +1 -0
  80. package/features/DestroyApp/DestroyApp.d.ts +1 -1
  81. package/features/GetAppOutput/GetAppOutput.d.ts +1 -1
  82. package/features/RefreshApp/RefreshApp.d.ts +1 -1
  83. package/features/RunPulumiCommand/RunPulumiCommand.d.ts +1 -1
  84. package/features/Serve/Serve.d.ts +10 -0
  85. package/features/Serve/Serve.js +15 -0
  86. package/features/Serve/Serve.js.map +1 -0
  87. package/features/Serve/index.d.ts +1 -0
  88. package/features/Serve/index.js +1 -0
  89. package/features/Watch/Watch.d.ts +3 -16
  90. package/features/Watch/Watch.js +4 -86
  91. package/features/Watch/Watch.js.map +1 -1
  92. package/features/Watch/watchers/ServersWatcher.d.ts +36 -0
  93. package/features/Watch/watchers/ServersWatcher.js +38 -0
  94. package/features/Watch/watchers/ServersWatcher.js.map +1 -0
  95. package/features/Watch/watchers/worker.js +3 -0
  96. package/features/Watch/watchers/worker.js.map +1 -1
  97. package/features/index.d.ts +1 -0
  98. package/features/index.js +1 -0
  99. package/index.d.ts +3 -1
  100. package/index.js +3 -1
  101. package/index.js.map +1 -1
  102. package/package.json +25 -25
  103. package/services/BuildAppWorkspaceService/BuildAppWorkspaceService.d.ts +2 -3
  104. package/services/BuildAppWorkspaceService/BuildAppWorkspaceService.js +11 -44
  105. package/services/BuildAppWorkspaceService/BuildAppWorkspaceService.js.map +1 -1
  106. package/services/BuildProjectWorkspaceService/BuildProjectWorkspaceService.js +4 -6
  107. package/services/BuildProjectWorkspaceService/BuildProjectWorkspaceService.js.map +1 -1
  108. package/services/GetProjectConfigService/ConfigRenderErrorBoundary.d.ts +15 -0
  109. package/services/GetProjectConfigService/ConfigRenderErrorBoundary.js +23 -0
  110. package/services/GetProjectConfigService/ConfigRenderErrorBoundary.js.map +1 -0
  111. package/services/GetProjectConfigService/EnvContext.d.ts +3 -2
  112. package/services/GetProjectConfigService/EnvContext.js +4 -6
  113. package/services/GetProjectConfigService/EnvContext.js.map +1 -1
  114. package/services/GetProjectConfigService/FeatureFlagsContext.d.ts +26 -0
  115. package/services/GetProjectConfigService/FeatureFlagsContext.js +41 -0
  116. package/services/GetProjectConfigService/FeatureFlagsContext.js.map +1 -0
  117. package/services/GetProjectConfigService/GetProjectConfigService.js +14 -11
  118. package/services/GetProjectConfigService/GetProjectConfigService.js.map +1 -1
  119. package/services/GetProjectConfigService/LicenseDecoratedFeatureFlags.d.ts +8 -0
  120. package/services/GetProjectConfigService/LicenseDecoratedFeatureFlags.js +28 -0
  121. package/services/GetProjectConfigService/LicenseDecoratedFeatureFlags.js.map +1 -0
  122. package/services/GetProjectConfigService/WcpProjectLicenseContext.d.ts +1 -0
  123. package/services/GetProjectConfigService/WcpProjectLicenseContext.js +1 -0
  124. package/services/GetProjectConfigService/WcpProjectLicenseContext.js.map +1 -1
  125. package/services/GetProjectConfigService/getRenderCacheKey.d.ts +1 -0
  126. package/services/GetProjectConfigService/getRenderCacheKey.js +13 -0
  127. package/services/GetProjectConfigService/getRenderCacheKey.js.map +1 -0
  128. package/services/GetProjectConfigService/nullRenderer.d.ts +4 -0
  129. package/services/GetProjectConfigService/nullRenderer.js +51 -0
  130. package/services/GetProjectConfigService/nullRenderer.js.map +1 -0
  131. package/services/GetProjectConfigService/renderConfig.d.ts +3 -12
  132. package/services/GetProjectConfigService/renderConfig.js +10 -35
  133. package/services/GetProjectConfigService/renderConfig.js.map +1 -1
  134. package/services/GetProjectConfigService/renderExtensions.d.ts +8 -0
  135. package/services/GetProjectConfigService/renderExtensions.js +52 -0
  136. package/services/GetProjectConfigService/renderExtensions.js.map +1 -0
  137. package/services/InitProjectSdkService/InitProjectSdkService.js +5 -8
  138. package/services/InitProjectSdkService/InitProjectSdkService.js.map +1 -1
  139. package/services/InitProjectSdkService/applyWcpEnvVars.js +27 -9
  140. package/services/InitProjectSdkService/applyWcpEnvVars.js.map +1 -1
  141. package/services/ProjectInfoService/GetPulumiVersionService.js +3 -3
  142. package/services/ProjectInfoService/GetPulumiVersionService.js.map +1 -1
  143. package/services/PulumiExportService/PulumiExportService.js.map +1 -1
  144. package/services/PulumiGetStackOutputService/PulumiGetStackOutputService.js.map +1 -1
  145. package/services/PulumiSelectStackService/PulumiSelectStackService.js.map +1 -1
  146. package/services/UiService/UiService.d.ts +18 -0
  147. package/services/UiService/UiService.js +18 -2
  148. package/services/UiService/UiService.js.map +1 -1
  149. package/services/ValidateProjectConfigService/ValidateProjectConfigService.js +10 -7
  150. package/services/ValidateProjectConfigService/ValidateProjectConfigService.js.map +1 -1
  151. package/services/WcpService/GetProjectEnvironment.js +16 -5
  152. package/services/WcpService/GetProjectEnvironment.js.map +1 -1
  153. package/services/WcpService/WcpGqlClient.js +2 -2
  154. package/services/WcpService/WcpGqlClient.js.map +1 -1
  155. package/services/WcpService/fetchProjectEnvironmentByApiKey.d.ts +8 -0
  156. package/services/WcpService/fetchProjectEnvironmentByApiKey.js +21 -0
  157. package/services/WcpService/fetchProjectEnvironmentByApiKey.js.map +1 -0
  158. package/services/index.d.ts +0 -1
  159. package/services/index.js +0 -1
  160. package/utils/apiRuntimeEnv.d.ts +20 -0
  161. package/utils/apiRuntimeEnv.js +51 -0
  162. package/utils/apiRuntimeEnv.js.map +1 -0
  163. package/utils/index.d.ts +2 -1
  164. package/utils/index.js +2 -1
  165. package/utils/trace/TraceRecorder.d.ts +17 -0
  166. package/utils/trace/TraceRecorder.js +51 -0
  167. package/utils/trace/TraceRecorder.js.map +1 -0
  168. package/utils/trace/formatTraceReport.d.ts +2 -0
  169. package/utils/trace/formatTraceReport.js +53 -0
  170. package/utils/trace/formatTraceReport.js.map +1 -0
  171. package/utils/trace/index.d.ts +6 -0
  172. package/utils/trace/index.js +6 -0
  173. package/utils/trace/isTraceRequested.d.ts +1 -0
  174. package/utils/trace/isTraceRequested.js +12 -0
  175. package/utils/trace/isTraceRequested.js.map +1 -0
  176. package/utils/trace/startTrace.d.ts +1 -0
  177. package/utils/trace/startTrace.js +19 -0
  178. package/utils/trace/startTrace.js.map +1 -0
  179. package/utils/trace/trace.d.ts +1 -0
  180. package/utils/trace/trace.js +13 -0
  181. package/utils/trace/trace.js.map +1 -0
  182. package/utils/trace/traceAsync.d.ts +1 -0
  183. package/utils/trace/traceAsync.js +13 -0
  184. package/utils/trace/traceAsync.js.map +1 -0
  185. package/components/Wcp.d.ts +0 -19
  186. package/components/Wcp.js +0 -37
  187. package/components/Wcp.js.map +0 -1
  188. package/extensions/Project/EnsureApiDeployedBeforeAdminBuild.d.ts +0 -11
  189. package/extensions/Project/EnsureApiDeployedBeforeAdminBuild.js +0 -30
  190. package/extensions/Project/EnsureApiDeployedBeforeAdminBuild.js.map +0 -1
  191. package/extensions/Project/EnsureApiDeployedBeforeAdminWatch.d.ts +0 -11
  192. package/extensions/Project/EnsureApiDeployedBeforeAdminWatch.js +0 -30
  193. package/extensions/Project/EnsureApiDeployedBeforeAdminWatch.js.map +0 -1
  194. package/extensions/Project/EnsureApiDeployedBeforeWatch.d.ts +0 -11
  195. package/extensions/Project/EnsureApiDeployedBeforeWatch.js +0 -30
  196. package/extensions/Project/EnsureApiDeployedBeforeWatch.js.map +0 -1
  197. package/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.d.ts +0 -11
  198. package/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.js +0 -31
  199. package/extensions/Project/EnsureCoreDeployedBeforeApiDeploy.js.map +0 -1
  200. package/extensions/Project/EnsureTelemetryEnabledForOss.d.ts +0 -13
  201. package/extensions/Project/EnsureTelemetryEnabledForOss.js +0 -34
  202. package/extensions/Project/EnsureTelemetryEnabledForOss.js.map +0 -1
  203. package/extensions/Project/TelemetryNoLongerNewUser.d.ts +0 -8
  204. package/extensions/Project/TelemetryNoLongerNewUser.js +0 -14
  205. package/extensions/Project/TelemetryNoLongerNewUser.js.map +0 -1
  206. package/extensions/Project/ValidateEncryptionBeforeDeploy.d.ts +0 -12
  207. package/extensions/Project/ValidateEncryptionBeforeDeploy.js +0 -31
  208. package/extensions/Project/ValidateEncryptionBeforeDeploy.js.map +0 -1
  209. package/extensions/Project/ValidateProductionPulumiState.d.ts +0 -12
  210. package/extensions/Project/ValidateProductionPulumiState.js +0 -33
  211. package/extensions/Project/ValidateProductionPulumiState.js.map +0 -1
  212. package/features/Watch/getIotEndpoint.d.ts +0 -2
  213. package/features/Watch/getIotEndpoint.js +0 -18
  214. package/features/Watch/getIotEndpoint.js.map +0 -1
  215. package/features/Watch/replaceLambdaFunctions.d.ts +0 -19
  216. package/features/Watch/replaceLambdaFunctions.js +0 -72
  217. package/features/Watch/replaceLambdaFunctions.js.map +0 -1
  218. package/rslib-runtime.js +0 -14
  219. package/rslib-runtime.js.map +0 -1
  220. package/services/GetProjectConfigService/renderConfigWorker.d.ts +0 -1
  221. package/services/GetProjectConfigService/renderConfigWorker.js +0 -63
  222. package/services/GetProjectConfigService/renderConfigWorker.js.map +0 -1
  223. package/services/GetPulumiService/GetPulumiService.d.ts +0 -9
  224. package/services/GetPulumiService/GetPulumiService.js +0 -44
  225. package/services/GetPulumiService/GetPulumiService.js.map +0 -1
  226. package/services/GetPulumiService/index.d.ts +0 -1
  227. package/services/GetPulumiService/index.js +0 -1
  228. package/utils/getTemplatesFolderPath.d.ts +0 -1
  229. package/utils/getTemplatesFolderPath.js +0 -11
  230. package/utils/getTemplatesFolderPath.js.map +0 -1
@@ -1,9 +1,10 @@
1
- import { defineExtension, zodSrcPath } from "./index.js";
1
+ import { defineExtension, zodSrcPath } from "../defineExtension/index.js";
2
2
  import { ExtensionSrcResolver } from "../index.js";
3
3
  import { z } from "zod";
4
4
  import path from "path";
5
5
  import { Node, Project } from "ts-morph";
6
6
  import crypto_0 from "crypto";
7
+ import { hasDefaultExport } from "./hasDefaultExport.js";
7
8
  const ApiExtension = defineExtension({
8
9
  type: "Api/Extension",
9
10
  tags: {
@@ -41,8 +42,7 @@ const ApiExtension = defineExtension({
41
42
  const extensionProject = new Project();
42
43
  extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);
43
44
  const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);
44
- const hasDefaultExport = void 0 !== extensionSource.getDefaultExportSymbol();
45
- if (hasDefaultExport) source.insertImportDeclaration(index, {
45
+ if (hasDefaultExport(extensionSource)) source.insertImportDeclaration(index, {
46
46
  defaultImport: exportNameAlias,
47
47
  moduleSpecifier: importPath
48
48
  });
@@ -65,8 +65,10 @@ const ApiExtension = defineExtension({
65
65
  index = last.getChildIndex() + 1;
66
66
  }
67
67
  const registerExtensionPluginImportPath = "@webiny/handler/plugins/RegisterExtensionPlugin.js";
68
- const existingContextPluginImport = source.getImportDeclaration(registerExtensionPluginImportPath);
69
- if (!existingContextPluginImport) source.insertImportDeclaration(index, {
68
+ const existingRegisterExtensionPluginImport = source.getImportDeclaration(registerExtensionPluginImportPath);
69
+ if (existingRegisterExtensionPluginImport) {
70
+ if (!existingRegisterExtensionPluginImport.getNamedImports().some((i)=>"createRegisterExtensionPlugin" === i.getName())) existingRegisterExtensionPluginImport.addNamedImport("createRegisterExtensionPlugin");
71
+ } else source.insertImportDeclaration(index, {
70
72
  namedImports: [
71
73
  "createRegisterExtensionPlugin"
72
74
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/ApiExtension.js","sources":["../../src/extensions/ApiExtension.ts"],"sourcesContent":["import { defineExtension, zodSrcPath } from \"~/extensions/index.js\";\nimport { ExtensionSrcResolver } from \"~/index.js\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport crypto from \"crypto\";\n\nexport const ApiExtension = defineExtension({\n type: \"Api/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add any API extension.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name is always the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Alias name is \"ApiExtension_\" + hash of the file path. This way we\n // avoid potential naming conflicts and keep the identifier constant.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const exportNameAlias = `ApiExtension_${hash.slice(-10)}`;\n\n // Calculate import path relative to `extensions.ts` file.\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Check if the file has a default export using AST parsing.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n const hasDefaultExport = extensionSource.getDefaultExportSymbol() !== undefined;\n\n // Support both default and named exports.\n if (hasDefaultExport) {\n source.insertImportDeclaration(index, {\n defaultImport: exportNameAlias,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: exportNameAlias }],\n moduleSpecifier: importPath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${exportNameAlias});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const registerExtensionPluginImportPath =\n \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n const existingContextPluginImport = source.getImportDeclaration(\n registerExtensionPluginImportPath\n );\n if (!existingContextPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginImportPath\n });\n }\n }\n\n await source.save();\n }\n});\n"],"names":["ApiExtension","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","extensionFilePath","absoluteExtensionFilePath","ExtensionSrcResolver","extensionFileName","path","exportName","hash","crypto","exportNameAlias","importPath","Project","source","existingImportDeclaration","index","importDeclarations","last","extensionProject","extensionSource","hasDefaultExport","undefined","pluginsArray","node","Node","registerExtensionPluginImportPath","existingContextPluginImport"],"mappings":";;;;;;AAOO,MAAMA,eAAeC,gBAAgB;IACxC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,KAAKC,WAAW;gBAAEF;YAAQ;YAC1B,YAAYC,EAAE,MAAM,GAAG,QAAQ;QACnC;IAEJ,MAAM,OAAME,MAAM,EAAEC,GAAG;QACnB,MAAMC,uBAAuBD,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CACzD,IAAI,CAAC,QAAQ,OAAO,WAAW,OAAO,iBACtC,QAAQ;QAEb,MAAM,EAAE,KAAKE,iBAAiB,EAAE,GAAGH;QAGnC,MAAMI,4BAA4BC,qBAAqB,WAAW,CAC9DF,mBACAF,IAAI,OAAO;QAGf,MAAMK,oBAAoBC,KAAK,QAAQ,CAACH;QAGxC,MAAMI,aAAaR,OAAO,UAAU,IAAIO,KAAK,KAAK,CAACD,mBAAmB,IAAI;QAI1E,MAAMG,OAAOC,SAAAA,UAAiB,CAAC,UAAU,MAAM,CAACP,mBAAmB,MAAM,CAAC;QAC1E,MAAMQ,kBAAkB,CAAC,aAAa,EAAEF,KAAK,KAAK,CAAC,MAAM;QAGzD,MAAMG,aAAaL,KAAAA,QACN,CAACA,KAAK,OAAO,CAACL,uBAAuBE,2BAC7C,OAAO,CAAC,WAAW;QAExB,MAAMP,UAAU,IAAIgB;QACpBhB,QAAQ,mBAAmB,CAACK;QAE5B,MAAMY,SAASjB,QAAQ,oBAAoB,CAACK;QAE5C,MAAMa,4BAA4BD,OAAO,oBAAoB,CAACF;QAC9D,IAAIG,2BACA;QAGJ,IAAIC,QAAQ;QAEZ,MAAMC,qBAAqBH,OAAO,qBAAqB;QACvD,IAAIG,mBAAmB,MAAM,EAAE;YAC3B,MAAMC,OAAOD,kBAAkB,CAACA,mBAAmB,MAAM,GAAG,EAAE;YAC9DD,QAAQE,KAAK,aAAa,KAAK;QACnC;QAGA,MAAMC,mBAAmB,IAAIN;QAC7BM,iBAAiB,mBAAmB,CAACf;QACrC,MAAMgB,kBAAkBD,iBAAiB,oBAAoB,CAACf;QAC9D,MAAMiB,mBAAmBD,AAA6CE,WAA7CF,gBAAgB,sBAAsB;QAG/D,IAAIC,kBACAP,OAAO,uBAAuB,CAACE,OAAO;YAClC,eAAeL;YACf,iBAAiBC;QACrB;aAEAE,OAAO,uBAAuB,CAACE,OAAO;YAClC,cAAc;gBAAC;oBAAE,MAAMR;oBAAY,OAAOG;gBAAgB;aAAE;YAC5D,iBAAiBC;QACrB;QAGJ,MAAMW,eAAeT,OAAO,kBAAkB,CAACU,CAAAA,OAC3CC,KAAK,wBAAwB,CAACD;QAGlCD,aAAa,UAAU,CACnB,CAAC,6EAA6E,EAAEZ,gBAAgB,MAAM,CAAC;QAG3G;YACI,IAAIK,QAAQ;YAEZ,MAAMC,qBAAqBH,OAAO,qBAAqB;YACvD,IAAIG,mBAAmB,MAAM,EAAE;gBAC3B,MAAMC,OAAOD,kBAAkB,CAACA,mBAAmB,MAAM,GAAG,EAAE;gBAC9DD,QAAQE,KAAK,aAAa,KAAK;YACnC;YAEA,MAAMQ,oCACF;YACJ,MAAMC,8BAA8Bb,OAAO,oBAAoB,CAC3DY;YAEJ,IAAI,CAACC,6BACDb,OAAO,uBAAuB,CAACE,OAAO;gBAClC,cAAc;oBAAC;iBAAgC;gBAC/C,iBAAiBU;YACrB;QAER;QAEA,MAAMZ,OAAO,IAAI;IACrB;AACJ"}
1
+ {"version":3,"file":"extensions/ApiExtension.js","sources":["../../src/extensions/ApiExtension.ts"],"sourcesContent":["import { defineExtension } from \"~/defineExtension/index.js\";\nimport { zodSrcPath } from \"~/defineExtension/index.js\";\nimport { ExtensionSrcResolver } from \"~/index.js\";\nimport { z } from \"zod\";\nimport path from \"path\";\nimport { Node, Project, ArrayLiteralExpression } from \"ts-morph\";\nimport crypto from \"crypto\";\nimport { hasDefaultExport } from \"./hasDefaultExport.js\";\n\nexport const ApiExtension = defineExtension({\n type: \"Api/Extension\",\n tags: { runtimeContext: \"app-build\", appName: \"api\" },\n description: \"Add any API extension.\",\n multiple: true,\n paramsSchema: ({ project }) => {\n return z.object({\n src: zodSrcPath({ project }),\n exportName: z.string().optional()\n });\n },\n async build(params, ctx) {\n const extensionsTsFilePath = ctx.project.paths.workspaceFolder\n .join(\"apps\", \"api\", \"graphql\", \"src\", \"extensions.ts\")\n .toString();\n\n const { src: extensionFilePath } = params;\n\n // Resolve to absolute path for file operations.\n const absoluteExtensionFilePath = ExtensionSrcResolver.resolvePath(\n extensionFilePath,\n ctx.project\n );\n\n const extensionFileName = path.basename(absoluteExtensionFilePath);\n\n // Export name is always the file name without extension.\n const exportName = params.exportName ?? path.parse(extensionFileName).name;\n\n // Alias name is \"ApiExtension_\" + hash of the file path. This way we\n // avoid potential naming conflicts and keep the identifier constant.\n const hash = crypto.createHash(\"sha256\").update(extensionFilePath).digest(\"hex\");\n const exportNameAlias = `ApiExtension_${hash.slice(-10)}`;\n\n // Calculate import path relative to `extensions.ts` file.\n const importPath = path\n .relative(path.dirname(extensionsTsFilePath), absoluteExtensionFilePath)\n .replace(/\\.tsx?$/, \".js\");\n\n const project = new Project();\n project.addSourceFileAtPath(extensionsTsFilePath);\n\n const source = project.getSourceFileOrThrow(extensionsTsFilePath);\n\n const existingImportDeclaration = source.getImportDeclaration(importPath);\n if (existingImportDeclaration) {\n return;\n }\n\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n // Check if the file has a default export using AST parsing.\n const extensionProject = new Project();\n extensionProject.addSourceFileAtPath(absoluteExtensionFilePath);\n const extensionSource = extensionProject.getSourceFileOrThrow(absoluteExtensionFilePath);\n\n // Support both default and named exports.\n if (hasDefaultExport(extensionSource)) {\n source.insertImportDeclaration(index, {\n defaultImport: exportNameAlias,\n moduleSpecifier: importPath\n });\n } else {\n source.insertImportDeclaration(index, {\n namedImports: [{ name: exportName, alias: exportNameAlias }],\n moduleSpecifier: importPath\n });\n }\n\n const pluginsArray = source.getFirstDescendant(node =>\n Node.isArrayLiteralExpression(node)\n ) as ArrayLiteralExpression;\n\n pluginsArray.addElement(\n `\\ncreateRegisterExtensionPlugin(ctx => {\\n\\tregisterExtension(ctx.container, ${exportNameAlias});\\n})`\n );\n\n {\n let index = 1;\n\n const importDeclarations = source.getImportDeclarations();\n if (importDeclarations.length) {\n const last = importDeclarations[importDeclarations.length - 1];\n index = last.getChildIndex() + 1;\n }\n\n const registerExtensionPluginImportPath =\n \"@webiny/handler/plugins/RegisterExtensionPlugin.js\";\n const existingRegisterExtensionPluginImport = source.getImportDeclaration(\n registerExtensionPluginImportPath\n );\n if (!existingRegisterExtensionPluginImport) {\n source.insertImportDeclaration(index, {\n namedImports: [\"createRegisterExtensionPlugin\"],\n moduleSpecifier: registerExtensionPluginImportPath\n });\n } else if (\n !existingRegisterExtensionPluginImport\n .getNamedImports()\n .some(i => i.getName() === \"createRegisterExtensionPlugin\")\n ) {\n // BuildParam imports `createRegisterBuildParamPlugin` from the same path.\n existingRegisterExtensionPluginImport.addNamedImport(\n \"createRegisterExtensionPlugin\"\n );\n }\n }\n\n await source.save();\n }\n});\n"],"names":["ApiExtension","defineExtension","project","z","zodSrcPath","params","ctx","extensionsTsFilePath","extensionFilePath","absoluteExtensionFilePath","ExtensionSrcResolver","extensionFileName","path","exportName","hash","crypto","exportNameAlias","importPath","Project","source","existingImportDeclaration","index","importDeclarations","last","extensionProject","extensionSource","hasDefaultExport","pluginsArray","node","Node","registerExtensionPluginImportPath","existingRegisterExtensionPluginImport","i"],"mappings":";;;;;;;AASO,MAAMA,eAAeC,gBAAgB;IACxC,MAAM;IACN,MAAM;QAAE,gBAAgB;QAAa,SAAS;IAAM;IACpD,aAAa;IACb,UAAU;IACV,cAAc,CAAC,EAAEC,OAAO,EAAE,GACfC,EAAE,MAAM,CAAC;YACZ,KAAKC,WAAW;gBAAEF;YAAQ;YAC1B,YAAYC,EAAE,MAAM,GAAG,QAAQ;QACnC;IAEJ,MAAM,OAAME,MAAM,EAAEC,GAAG;QACnB,MAAMC,uBAAuBD,IAAI,OAAO,CAAC,KAAK,CAAC,eAAe,CACzD,IAAI,CAAC,QAAQ,OAAO,WAAW,OAAO,iBACtC,QAAQ;QAEb,MAAM,EAAE,KAAKE,iBAAiB,EAAE,GAAGH;QAGnC,MAAMI,4BAA4BC,qBAAqB,WAAW,CAC9DF,mBACAF,IAAI,OAAO;QAGf,MAAMK,oBAAoBC,KAAK,QAAQ,CAACH;QAGxC,MAAMI,aAAaR,OAAO,UAAU,IAAIO,KAAK,KAAK,CAACD,mBAAmB,IAAI;QAI1E,MAAMG,OAAOC,SAAAA,UAAiB,CAAC,UAAU,MAAM,CAACP,mBAAmB,MAAM,CAAC;QAC1E,MAAMQ,kBAAkB,CAAC,aAAa,EAAEF,KAAK,KAAK,CAAC,MAAM;QAGzD,MAAMG,aAAaL,KAAAA,QACN,CAACA,KAAK,OAAO,CAACL,uBAAuBE,2BAC7C,OAAO,CAAC,WAAW;QAExB,MAAMP,UAAU,IAAIgB;QACpBhB,QAAQ,mBAAmB,CAACK;QAE5B,MAAMY,SAASjB,QAAQ,oBAAoB,CAACK;QAE5C,MAAMa,4BAA4BD,OAAO,oBAAoB,CAACF;QAC9D,IAAIG,2BACA;QAGJ,IAAIC,QAAQ;QAEZ,MAAMC,qBAAqBH,OAAO,qBAAqB;QACvD,IAAIG,mBAAmB,MAAM,EAAE;YAC3B,MAAMC,OAAOD,kBAAkB,CAACA,mBAAmB,MAAM,GAAG,EAAE;YAC9DD,QAAQE,KAAK,aAAa,KAAK;QACnC;QAGA,MAAMC,mBAAmB,IAAIN;QAC7BM,iBAAiB,mBAAmB,CAACf;QACrC,MAAMgB,kBAAkBD,iBAAiB,oBAAoB,CAACf;QAG9D,IAAIiB,iBAAiBD,kBACjBN,OAAO,uBAAuB,CAACE,OAAO;YAClC,eAAeL;YACf,iBAAiBC;QACrB;aAEAE,OAAO,uBAAuB,CAACE,OAAO;YAClC,cAAc;gBAAC;oBAAE,MAAMR;oBAAY,OAAOG;gBAAgB;aAAE;YAC5D,iBAAiBC;QACrB;QAGJ,MAAMU,eAAeR,OAAO,kBAAkB,CAACS,CAAAA,OAC3CC,KAAK,wBAAwB,CAACD;QAGlCD,aAAa,UAAU,CACnB,CAAC,6EAA6E,EAAEX,gBAAgB,MAAM,CAAC;QAG3G;YACI,IAAIK,QAAQ;YAEZ,MAAMC,qBAAqBH,OAAO,qBAAqB;YACvD,IAAIG,mBAAmB,MAAM,EAAE;gBAC3B,MAAMC,OAAOD,kBAAkB,CAACA,mBAAmB,MAAM,GAAG,EAAE;gBAC9DD,QAAQE,KAAK,aAAa,KAAK;YACnC;YAEA,MAAMO,oCACF;YACJ,MAAMC,wCAAwCZ,OAAO,oBAAoB,CACrEW;YAEJ,IAAKC,uCAKE;gBAAA,IACH,CAACA,sCACI,eAAe,GACf,IAAI,CAACC,CAAAA,IAAKA,AAAgB,oCAAhBA,EAAE,OAAO,KAGxBD,sCAAsC,cAAc,CAChD;YAER,OAbIZ,OAAO,uBAAuB,CAACE,OAAO;gBAClC,cAAc;oBAAC;iBAAgC;gBAC/C,iBAAiBS;YACrB;QAWR;QAEA,MAAMX,OAAO,IAAI;IACrB;AACJ"}
@@ -0,0 +1,6 @@
1
+ import { z } from "zod";
2
+ export declare const BugReporter: import("~/defineExtension/index.js").ExtensionComponent<z.ZodObject<{
3
+ token: z.ZodOptional<z.ZodString>;
4
+ repository: z.ZodOptional<z.ZodString>;
5
+ labels: z.ZodOptional<z.ZodString>;
6
+ }, z.core.$strip>>;
@@ -0,0 +1,33 @@
1
+ import react from "react";
2
+ import { z } from "zod";
3
+ import { BuildParam } from "./ApiBuildParam.js";
4
+ import { AdminBuildParam } from "./AdminBuildParam.js";
5
+ import { defineExtension } from "../defineExtension/index.js";
6
+ const BugReporter = defineExtension({
7
+ type: "Project/BugReporter",
8
+ tags: {
9
+ runtimeContext: "project"
10
+ },
11
+ description: "Point the bug reporter at a GitHub repository, so the API files issues itself.",
12
+ paramsSchema: z.object({
13
+ token: z.string().optional().describe("GitHub PAT with write on BOTH issues and contents. Contents is not optional once anyone pastes a screenshot: issues have no attachment API, so images are committed to a branch. Always pass it through an env var, never a literal, since the value is serialized into the build artifact."),
14
+ repository: z.string().optional().describe("Target repository as `owner/name`. Filing requires this as well as a token; a token on its own leaves the reporter in compose mode."),
15
+ labels: z.string().optional().describe("Comma separated labels applied to every issue. Defaults to `bug`. Every issue also gets `reported-in-app`.")
16
+ }),
17
+ render: ({ token, repository, labels })=>/*#__PURE__*/ react.createElement(react.Fragment, null, token ? /*#__PURE__*/ react.createElement(BuildParam, {
18
+ paramName: "BUG_REPORT_GITHUB_TOKEN",
19
+ value: token
20
+ }) : null, repository ? /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(BuildParam, {
21
+ paramName: "BUG_REPORT_REPOSITORY",
22
+ value: repository
23
+ }), /*#__PURE__*/ react.createElement(AdminBuildParam, {
24
+ paramName: "BUG_REPORT_REPOSITORY",
25
+ value: repository
26
+ })) : null, labels ? /*#__PURE__*/ react.createElement(BuildParam, {
27
+ paramName: "BUG_REPORT_LABELS",
28
+ value: labels
29
+ }) : null)
30
+ });
31
+ export { BugReporter };
32
+
33
+ //# sourceMappingURL=BugReporter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions/BugReporter.js","sources":["../../src/extensions/BugReporter.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { BuildParam } from \"./ApiBuildParam.js\";\nimport { AdminBuildParam } from \"./AdminBuildParam.js\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\n\n/*\n * The bug reporter is enabled in every project through DefaultExtensions, so this extension is not\n * what turns it on. Without it the reporter runs in compose mode: the API writes the report up and\n * returns a prefilled GitHub issues/new URL, which the reporter submits under their own account and\n * which needs no credentials. This is what switches it to filing the issue itself.\n *\n * Lives here rather than in @webiny/bug-reporter because that package already depends on\n * @webiny/project-aws for `Api` and `Admin`, so having the Project namespace reach back into it\n * would close a cycle. Nothing is lost: the render only emits build params, and the API owns every\n * default, so there is one place they live rather than two that can drift.\n */\nexport const BugReporter = defineExtension({\n type: \"Project/BugReporter\",\n tags: { runtimeContext: \"project\" },\n description: \"Point the bug reporter at a GitHub repository, so the API files issues itself.\",\n paramsSchema: z.object({\n token: z\n .string()\n .optional()\n .describe(\n \"GitHub PAT with write on BOTH issues and contents. Contents is not optional once anyone pastes a screenshot: issues have no attachment API, so images are committed to a branch. Always pass it through an env var, never a literal, since the value is serialized into the build artifact.\"\n ),\n repository: z\n .string()\n .optional()\n .describe(\n \"Target repository as `owner/name`. Filing requires this as well as a token; a token on its own leaves the reporter in compose mode.\"\n ),\n labels: z\n .string()\n .optional()\n .describe(\n \"Comma separated labels applied to every issue. Defaults to `bug`. Every issue also gets `reported-in-app`.\"\n )\n }),\n render: ({ token, repository, labels }) => {\n return (\n <>\n {token ? <BuildParam paramName=\"BUG_REPORT_GITHUB_TOKEN\" value={token} /> : null}\n {/*\n * The repository goes to the admin app too, so the dialog can name where a report\n * is headed before the reporter sends it. The token never does: an admin build\n * param is serialized into the browser bundle.\n */}\n {repository ? (\n <>\n <BuildParam paramName=\"BUG_REPORT_REPOSITORY\" value={repository} />\n <AdminBuildParam paramName=\"BUG_REPORT_REPOSITORY\" value={repository} />\n </>\n ) : null}\n {labels ? <BuildParam paramName=\"BUG_REPORT_LABELS\" value={labels} /> : null}\n </>\n );\n }\n});\n"],"names":["BugReporter","defineExtension","z","token","repository","labels","BuildParam","AdminBuildParam"],"mappings":";;;;;AAiBO,MAAMA,cAAcC,gBAAgB;IACvC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QACnB,OAAOA,EAAAA,MACI,GACN,QAAQ,GACR,QAAQ,CACL;QAER,YAAYA,EAAAA,MACD,GACN,QAAQ,GACR,QAAQ,CACL;QAER,QAAQA,EAAAA,MACG,GACN,QAAQ,GACR,QAAQ,CACL;IAEZ;IACA,QAAQ,CAAC,EAAEC,KAAK,EAAEC,UAAU,EAAEC,MAAM,EAAE,GAC3B,WAAP,GACI,0CACKF,QAAQ,WAARA,GAAQ,oBAACG,YAAUA;YAAC,WAAU;YAA0B,OAAOH;aAAY,MAM3EC,aAAa,WAAbA,GACG,wDACI,oBAACE,YAAUA;YAAC,WAAU;YAAwB,OAAOF;0BACrD,oBAACG,iBAAeA;YAAC,WAAU;YAAwB,OAAOH;cAE9D,MACHC,SAAS,WAATA,GAAS,oBAACC,YAAUA;YAAC,WAAU;YAAoB,OAAOD;aAAa;AAIxF"}
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  export declare const FeatureFlags: import("~/defineExtension/index.js").ExtensionComponent<z.ZodObject<{
3
3
  features: z.ZodObject<{
4
4
  multiTenancy: z.ZodOptional<z.ZodBoolean>;
5
+ languages: z.ZodOptional<z.ZodBoolean>;
5
6
  advancedPublishingWorkflow: z.ZodOptional<z.ZodBoolean>;
6
7
  advancedAccessControlLayer: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
7
8
  teams: z.ZodOptional<z.ZodBoolean>;
@@ -14,23 +15,27 @@ export declare const FeatureFlags: import("~/defineExtension/index.js").Extensio
14
15
  fileManager: z.ZodOptional<z.ZodObject<{
15
16
  threatDetection: z.ZodOptional<z.ZodBoolean>;
16
17
  }, z.core.$strip>>;
17
- aiPowerups: z.ZodOptional<z.ZodObject<{
18
- enabled: z.ZodOptional<z.ZodBoolean>;
19
- options: z.ZodOptional<z.ZodObject<{
20
- websiteBuilder: z.ZodOptional<z.ZodObject<{
21
- pageGeneration: z.ZodOptional<z.ZodBoolean>;
22
- pageTranslation: z.ZodOptional<z.ZodBoolean>;
23
- }, z.core.$strip>>;
24
- fileManager: z.ZodOptional<z.ZodObject<{
25
- imageEnrichment: z.ZodOptional<z.ZodBoolean>;
26
- }, z.core.$strip>>;
27
- lexicalGeneration: z.ZodOptional<z.ZodBoolean>;
28
- cms: z.ZodOptional<z.ZodObject<{
29
- entryGeneration: z.ZodOptional<z.ZodBoolean>;
30
- entryComparison: z.ZodOptional<z.ZodBoolean>;
31
- entryTranslation: z.ZodOptional<z.ZodBoolean>;
32
- }, z.core.$strip>>;
18
+ aiPowerups: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
19
+ websiteBuilder: z.ZodOptional<z.ZodObject<{
20
+ pageGeneration: z.ZodOptional<z.ZodBoolean>;
21
+ pageTranslation: z.ZodOptional<z.ZodBoolean>;
33
22
  }, z.core.$strip>>;
34
- }, z.core.$strip>>;
23
+ fileManager: z.ZodOptional<z.ZodObject<{
24
+ imageEnrichment: z.ZodOptional<z.ZodBoolean>;
25
+ }, z.core.$strip>>;
26
+ lexicalGeneration: z.ZodOptional<z.ZodBoolean>;
27
+ adminAssistant: z.ZodOptional<z.ZodBoolean>;
28
+ remoteComponents: z.ZodOptional<z.ZodBoolean>;
29
+ cms: z.ZodOptional<z.ZodObject<{
30
+ entryGeneration: z.ZodOptional<z.ZodBoolean>;
31
+ entryComparison: z.ZodOptional<z.ZodBoolean>;
32
+ entryTranslation: z.ZodOptional<z.ZodBoolean>;
33
+ }, z.core.$strip>>;
34
+ }, z.core.$strip>]>>;
35
+ abTesting: z.ZodOptional<z.ZodBoolean>;
36
+ collaboration: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
37
+ comments: z.ZodOptional<z.ZodBoolean>;
38
+ activityLog: z.ZodOptional<z.ZodBoolean>;
39
+ }, z.core.$strip>]>>;
35
40
  }, z.core.$strip>;
36
41
  }, z.core.$strip>>;
@@ -3,15 +3,17 @@ import { z } from "zod";
3
3
  import { BuildParam } from "./ApiBuildParam.js";
4
4
  import { AdminBuildParam } from "./AdminBuildParam.js";
5
5
  import { defineExtension } from "../defineExtension/index.js";
6
+ import { setProjectFeatureFlags } from "../services/GetProjectConfigService/FeatureFlagsContext.js";
6
7
  const FeatureFlags = defineExtension({
7
8
  type: "FeatureFlags",
8
9
  tags: {
9
10
  runtimeContext: "project"
10
11
  },
11
- description: "Enable or disable WCP features.",
12
+ description: "Enable or disable features.",
12
13
  paramsSchema: z.object({
13
14
  features: z.object({
14
15
  multiTenancy: z.boolean().optional(),
16
+ languages: z.boolean().optional(),
15
17
  advancedPublishingWorkflow: z.boolean().optional(),
16
18
  advancedAccessControlLayer: z.union([
17
19
  z.boolean(),
@@ -27,9 +29,9 @@ const FeatureFlags = defineExtension({
27
29
  fileManager: z.object({
28
30
  threatDetection: z.boolean().optional()
29
31
  }).optional(),
30
- aiPowerups: z.object({
31
- enabled: z.boolean().optional(),
32
- options: z.object({
32
+ aiPowerups: z.union([
33
+ z.boolean(),
34
+ z.object({
33
35
  websiteBuilder: z.object({
34
36
  pageGeneration: z.boolean().optional(),
35
37
  pageTranslation: z.boolean().optional()
@@ -38,22 +40,35 @@ const FeatureFlags = defineExtension({
38
40
  imageEnrichment: z.boolean().optional()
39
41
  }).optional(),
40
42
  lexicalGeneration: z.boolean().optional(),
43
+ adminAssistant: z.boolean().optional(),
44
+ remoteComponents: z.boolean().optional(),
41
45
  cms: z.object({
42
46
  entryGeneration: z.boolean().optional(),
43
47
  entryComparison: z.boolean().optional(),
44
48
  entryTranslation: z.boolean().optional()
45
49
  }).optional()
46
- }).optional()
47
- }).optional()
50
+ })
51
+ ]).optional(),
52
+ abTesting: z.boolean().optional(),
53
+ collaboration: z.union([
54
+ z.boolean(),
55
+ z.object({
56
+ comments: z.boolean().optional(),
57
+ activityLog: z.boolean().optional()
58
+ })
59
+ ]).optional()
48
60
  })
49
61
  }),
50
- render: ({ features = {} })=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(BuildParam, {
62
+ render: ({ features = {} })=>{
63
+ setProjectFeatureFlags(features);
64
+ return /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(BuildParam, {
51
65
  paramName: "FeatureFlags",
52
66
  value: features
53
67
  }), /*#__PURE__*/ react.createElement(AdminBuildParam, {
54
68
  paramName: "FeatureFlags",
55
69
  value: features
56
- }))
70
+ }));
71
+ }
57
72
  });
58
73
  export { FeatureFlags };
59
74
 
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/FeatureFlags.js","sources":["../../src/extensions/FeatureFlags.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { BuildParam } from \"./ApiBuildParam.js\";\nimport { AdminBuildParam } from \"./AdminBuildParam.js\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\n\nexport const FeatureFlags = defineExtension({\n type: \"FeatureFlags\",\n tags: { runtimeContext: \"project\" },\n description: \"Enable or disable WCP features.\",\n paramsSchema: z.object({\n // Follows `IFeatureFlagsDto` from `packages/feature-flags/src/types.ts`.\n features: z.object({\n multiTenancy: z.boolean().optional(),\n advancedPublishingWorkflow: z.boolean().optional(),\n advancedAccessControlLayer: z\n .union([\n z.boolean(),\n z.object({\n teams: z.boolean().optional(),\n privateFiles: z.boolean().optional(),\n folderLevelPermissions: z.boolean().optional(),\n hcmsFieldPermissions: z.boolean().optional()\n })\n ])\n .optional(),\n auditLogs: z.boolean().optional(),\n recordLocking: z.boolean().optional(),\n fileManager: z\n .object({\n threatDetection: z.boolean().optional()\n })\n .optional(),\n aiPowerups: z\n .object({\n enabled: z.boolean().optional(),\n options: z\n .object({\n websiteBuilder: z\n .object({\n pageGeneration: z.boolean().optional(),\n pageTranslation: z.boolean().optional()\n })\n .optional(),\n fileManager: z\n .object({\n imageEnrichment: z.boolean().optional()\n })\n .optional(),\n lexicalGeneration: z.boolean().optional(),\n cms: z\n .object({\n entryGeneration: z.boolean().optional(),\n entryComparison: z.boolean().optional(),\n entryTranslation: z.boolean().optional()\n })\n .optional()\n })\n .optional()\n })\n .optional()\n })\n }),\n render: ({ features = {} }) => {\n return (\n <>\n <BuildParam paramName=\"FeatureFlags\" value={features} />\n <AdminBuildParam paramName=\"FeatureFlags\" value={features} />\n </>\n );\n }\n});\n"],"names":["FeatureFlags","defineExtension","z","features","BuildParam","AdminBuildParam"],"mappings":";;;;;AAMO,MAAMA,eAAeC,gBAAgB;IACxC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QAEnB,UAAUA,EAAE,MAAM,CAAC;YACf,cAAcA,EAAE,OAAO,GAAG,QAAQ;YAClC,4BAA4BA,EAAE,OAAO,GAAG,QAAQ;YAChD,4BAA4BA,EAAAA,KAClB,CAAC;gBACHA,EAAE,OAAO;gBACTA,EAAE,MAAM,CAAC;oBACL,OAAOA,EAAE,OAAO,GAAG,QAAQ;oBAC3B,cAAcA,EAAE,OAAO,GAAG,QAAQ;oBAClC,wBAAwBA,EAAE,OAAO,GAAG,QAAQ;oBAC5C,sBAAsBA,EAAE,OAAO,GAAG,QAAQ;gBAC9C;aACH,EACA,QAAQ;YACb,WAAWA,EAAE,OAAO,GAAG,QAAQ;YAC/B,eAAeA,EAAE,OAAO,GAAG,QAAQ;YACnC,aAAaA,EAAAA,MACF,CAAC;gBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;YACzC,GACC,QAAQ;YACb,YAAYA,EAAAA,MACD,CAAC;gBACJ,SAASA,EAAE,OAAO,GAAG,QAAQ;gBAC7B,SAASA,EAAAA,MACE,CAAC;oBACJ,gBAAgBA,EAAAA,MACL,CAAC;wBACJ,gBAAgBA,EAAE,OAAO,GAAG,QAAQ;wBACpC,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;oBACzC,GACC,QAAQ;oBACb,aAAaA,EAAAA,MACF,CAAC;wBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;oBACzC,GACC,QAAQ;oBACb,mBAAmBA,EAAE,OAAO,GAAG,QAAQ;oBACvC,KAAKA,EAAAA,MACM,CAAC;wBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;wBACrC,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;wBACrC,kBAAkBA,EAAE,OAAO,GAAG,QAAQ;oBAC1C,GACC,QAAQ;gBACjB,GACC,QAAQ;YACjB,GACC,QAAQ;QACjB;IACJ;IACA,QAAQ,CAAC,EAAEC,WAAW,CAAC,CAAC,EAAE,GACf,WAAP,GACI,wDACI,oBAACC,YAAUA;YAAC,WAAU;YAAe,OAAOD;0BAC5C,oBAACE,iBAAeA;YAAC,WAAU;YAAe,OAAOF;;AAIjE"}
1
+ {"version":3,"file":"extensions/FeatureFlags.js","sources":["../../src/extensions/FeatureFlags.tsx"],"sourcesContent":["import React from \"react\";\nimport { z } from \"zod\";\nimport { BuildParam } from \"./ApiBuildParam.js\";\nimport { AdminBuildParam } from \"./AdminBuildParam.js\";\nimport { defineExtension } from \"~/defineExtension/index.js\";\nimport { setProjectFeatureFlags } from \"~/services/GetProjectConfigService/FeatureFlagsContext.js\";\n\nexport const FeatureFlags = defineExtension({\n type: \"FeatureFlags\",\n tags: { runtimeContext: \"project\" },\n description: \"Enable or disable features.\",\n paramsSchema: z.object({\n // Follows `IFeatureFlagsDto` from `packages/feature-flags/src/types.ts`.\n features: z.object({\n multiTenancy: z.boolean().optional(),\n languages: z.boolean().optional(),\n advancedPublishingWorkflow: z.boolean().optional(),\n advancedAccessControlLayer: z\n .union([\n z.boolean(),\n z.object({\n teams: z.boolean().optional(),\n privateFiles: z.boolean().optional(),\n folderLevelPermissions: z.boolean().optional(),\n hcmsFieldPermissions: z.boolean().optional()\n })\n ])\n .optional(),\n auditLogs: z.boolean().optional(),\n recordLocking: z.boolean().optional(),\n fileManager: z\n .object({\n threatDetection: z.boolean().optional()\n })\n .optional(),\n aiPowerups: z\n .union([\n z.boolean(),\n z.object({\n websiteBuilder: z\n .object({\n pageGeneration: z.boolean().optional(),\n pageTranslation: z.boolean().optional()\n })\n .optional(),\n fileManager: z\n .object({\n imageEnrichment: z.boolean().optional()\n })\n .optional(),\n lexicalGeneration: z.boolean().optional(),\n adminAssistant: z.boolean().optional(),\n remoteComponents: z.boolean().optional(),\n cms: z\n .object({\n entryGeneration: z.boolean().optional(),\n entryComparison: z.boolean().optional(),\n entryTranslation: z.boolean().optional()\n })\n .optional()\n })\n ])\n .optional(),\n abTesting: z.boolean().optional(),\n collaboration: z\n .union([\n z.boolean(),\n z.object({\n comments: z.boolean().optional(),\n activityLog: z.boolean().optional()\n })\n ])\n .optional()\n })\n }),\n render: ({ features = {} }) => {\n setProjectFeatureFlags(features);\n return (\n <>\n <BuildParam paramName=\"FeatureFlags\" value={features} />\n <AdminBuildParam paramName=\"FeatureFlags\" value={features} />\n </>\n );\n }\n});\n"],"names":["FeatureFlags","defineExtension","z","features","setProjectFeatureFlags","BuildParam","AdminBuildParam"],"mappings":";;;;;;AAOO,MAAMA,eAAeC,gBAAgB;IACxC,MAAM;IACN,MAAM;QAAE,gBAAgB;IAAU;IAClC,aAAa;IACb,cAAcC,EAAE,MAAM,CAAC;QAEnB,UAAUA,EAAE,MAAM,CAAC;YACf,cAAcA,EAAE,OAAO,GAAG,QAAQ;YAClC,WAAWA,EAAE,OAAO,GAAG,QAAQ;YAC/B,4BAA4BA,EAAE,OAAO,GAAG,QAAQ;YAChD,4BAA4BA,EAAAA,KAClB,CAAC;gBACHA,EAAE,OAAO;gBACTA,EAAE,MAAM,CAAC;oBACL,OAAOA,EAAE,OAAO,GAAG,QAAQ;oBAC3B,cAAcA,EAAE,OAAO,GAAG,QAAQ;oBAClC,wBAAwBA,EAAE,OAAO,GAAG,QAAQ;oBAC5C,sBAAsBA,EAAE,OAAO,GAAG,QAAQ;gBAC9C;aACH,EACA,QAAQ;YACb,WAAWA,EAAE,OAAO,GAAG,QAAQ;YAC/B,eAAeA,EAAE,OAAO,GAAG,QAAQ;YACnC,aAAaA,EAAAA,MACF,CAAC;gBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;YACzC,GACC,QAAQ;YACb,YAAYA,EAAAA,KACF,CAAC;gBACHA,EAAE,OAAO;gBACTA,EAAE,MAAM,CAAC;oBACL,gBAAgBA,EAAAA,MACL,CAAC;wBACJ,gBAAgBA,EAAE,OAAO,GAAG,QAAQ;wBACpC,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;oBACzC,GACC,QAAQ;oBACb,aAAaA,EAAAA,MACF,CAAC;wBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;oBACzC,GACC,QAAQ;oBACb,mBAAmBA,EAAE,OAAO,GAAG,QAAQ;oBACvC,gBAAgBA,EAAE,OAAO,GAAG,QAAQ;oBACpC,kBAAkBA,EAAE,OAAO,GAAG,QAAQ;oBACtC,KAAKA,EAAAA,MACM,CAAC;wBACJ,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;wBACrC,iBAAiBA,EAAE,OAAO,GAAG,QAAQ;wBACrC,kBAAkBA,EAAE,OAAO,GAAG,QAAQ;oBAC1C,GACC,QAAQ;gBACjB;aACH,EACA,QAAQ;YACb,WAAWA,EAAE,OAAO,GAAG,QAAQ;YAC/B,eAAeA,EAAAA,KACL,CAAC;gBACHA,EAAE,OAAO;gBACTA,EAAE,MAAM,CAAC;oBACL,UAAUA,EAAE,OAAO,GAAG,QAAQ;oBAC9B,aAAaA,EAAE,OAAO,GAAG,QAAQ;gBACrC;aACH,EACA,QAAQ;QACjB;IACJ;IACA,QAAQ,CAAC,EAAEC,WAAW,CAAC,CAAC,EAAE;QACtBC,uBAAuBD;QACvB,OAAO,WAAP,GACI,wDACI,oBAACE,YAAUA;YAAC,WAAU;YAAe,OAAOF;0BAC5C,oBAACG,iBAAeA;YAAC,WAAU;YAAe,OAAOH;;IAG7D;AACJ"}
@@ -26,6 +26,7 @@ class SetAdminAppEnvVarsBeforeBuildImpl {
26
26
  const newUser = Boolean(globalConfig.get("newUser")).toString();
27
27
  process.env.REACT_APP_WEBINY_TELEMETRY_NEW_USER = newUser;
28
28
  }
29
+ if (!("REACT_APP_WEBINY_HOSTING_TYPE" in process.env) && process.env.WEBINY_HOSTING_TYPE) process.env.REACT_APP_WEBINY_HOSTING_TYPE = process.env.WEBINY_HOSTING_TYPE;
29
30
  if (!("INLINE_RUNTIME_CHUNK" in process.env)) process.env.INLINE_RUNTIME_CHUNK = "true";
30
31
  if (!("REACT_APP_IS_CI" in process.env)) process.env.REACT_APP_IS_CI = Boolean(isCI).toString();
31
32
  if (!("REACT_APP_WEBINY_VERSION" in process.env)) process.env.REACT_APP_WEBINY_VERSION = projectVersion;
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Project/SetAdminAppEnvVarsBeforeBuild.js","sources":["../../../src/extensions/Project/SetAdminAppEnvVarsBeforeBuild.ts"],"sourcesContent":["import {\n AdminBeforeBuild,\n GetProjectIdService,\n GetProjectInstallationIdService,\n GetProjectVersionService,\n IsTelemetryEnabled\n} from \"~/abstractions/index.js\";\nimport { globalConfig } from \"@webiny/global-config\";\nimport { isCI } from \"ci-info\";\n\nclass SetAdminAppEnvVarsBeforeBuildImpl implements AdminBeforeBuild.Interface {\n constructor(\n private isTelemetryEnabled: IsTelemetryEnabled.Interface,\n private getProjectIdService: GetProjectIdService.Interface,\n private getProjectInstallationIdService: GetProjectInstallationIdService.Interface,\n private getProjectVersionService: GetProjectVersionService.Interface\n ) {}\n\n async execute() {\n const projectId = await this.getProjectIdService.execute();\n const projectVersion = this.getProjectVersionService.execute();\n\n const telemetry = await this.isTelemetryEnabled.execute();\n\n if (projectId) {\n process.env.REACT_APP_WEBINY_PROJECT_ID = projectId;\n process.env.REACT_APP_WCP_PROJECT_ID = projectId;\n }\n\n if (!(\"REACT_APP_WEBINY_INSTALLATION_ID\" in process.env)) {\n const installationId = this.getProjectInstallationIdService.execute();\n if (installationId) {\n process.env.REACT_APP_WEBINY_INSTALLATION_ID = installationId;\n }\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY\" in process.env)) {\n process.env.REACT_APP_WEBINY_TELEMETRY = String(telemetry);\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY_USER_ID\" in process.env)) {\n process.env.REACT_APP_WEBINY_TELEMETRY_USER_ID = globalConfig.get(\"id\");\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY_NEW_USER\" in process.env)) {\n const newUser = Boolean(globalConfig.get(\"newUser\")).toString();\n process.env.REACT_APP_WEBINY_TELEMETRY_NEW_USER = newUser;\n }\n\n if (!(\"INLINE_RUNTIME_CHUNK\" in process.env)) {\n process.env.INLINE_RUNTIME_CHUNK = \"true\";\n }\n\n if (!(\"REACT_APP_IS_CI\" in process.env)) {\n process.env.REACT_APP_IS_CI = Boolean(isCI).toString();\n }\n\n if (!(\"REACT_APP_WEBINY_VERSION\" in process.env)) {\n process.env.REACT_APP_WEBINY_VERSION = projectVersion;\n }\n }\n}\n\nexport const SetAdminAppEnvVarsBeforeBuild = AdminBeforeBuild.createImplementation({\n implementation: SetAdminAppEnvVarsBeforeBuildImpl,\n dependencies: [\n IsTelemetryEnabled,\n GetProjectIdService,\n GetProjectInstallationIdService,\n GetProjectVersionService\n ]\n});\n"],"names":["SetAdminAppEnvVarsBeforeBuildImpl","isTelemetryEnabled","getProjectIdService","getProjectInstallationIdService","getProjectVersionService","projectId","projectVersion","telemetry","process","installationId","String","globalConfig","newUser","Boolean","isCI","SetAdminAppEnvVarsBeforeBuild","AdminBeforeBuild","IsTelemetryEnabled","GetProjectIdService","GetProjectInstallationIdService","GetProjectVersionService"],"mappings":";;;AAUA,MAAMA;IACF,YACYC,kBAAgD,EAChDC,mBAAkD,EAClDC,+BAA0E,EAC1EC,wBAA4D,CACtE;aAJUH,kBAAkB,GAAlBA;aACAC,mBAAmB,GAAnBA;aACAC,+BAA+B,GAA/BA;aACAC,wBAAwB,GAAxBA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,YAAY,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QACxD,MAAMC,iBAAiB,IAAI,CAAC,wBAAwB,CAAC,OAAO;QAE5D,MAAMC,YAAY,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO;QAEvD,IAAIF,WAAW;YACXG,QAAQ,GAAG,CAAC,2BAA2B,GAAGH;YAC1CG,QAAQ,GAAG,CAAC,wBAAwB,GAAGH;QAC3C;QAEA,IAAI,CAAE,uCAAsCG,QAAQ,GAAE,GAAI;YACtD,MAAMC,iBAAiB,IAAI,CAAC,+BAA+B,CAAC,OAAO;YACnE,IAAIA,gBACAD,QAAQ,GAAG,CAAC,gCAAgC,GAAGC;QAEvD;QAEA,IAAI,CAAE,iCAAgCD,QAAQ,GAAE,GAC5CA,QAAQ,GAAG,CAAC,0BAA0B,GAAGE,OAAOH;QAGpD,IAAI,CAAE,yCAAwCC,QAAQ,GAAE,GACpDA,QAAQ,GAAG,CAAC,kCAAkC,GAAGG,aAAa,GAAG,CAAC;QAGtE,IAAI,CAAE,0CAAyCH,QAAQ,GAAE,GAAI;YACzD,MAAMI,UAAUC,QAAQF,aAAa,GAAG,CAAC,YAAY,QAAQ;YAC7DH,QAAQ,GAAG,CAAC,mCAAmC,GAAGI;QACtD;QAEA,IAAI,CAAE,2BAA0BJ,QAAQ,GAAE,GACtCA,QAAQ,GAAG,CAAC,oBAAoB,GAAG;QAGvC,IAAI,CAAE,sBAAqBA,QAAQ,GAAE,GACjCA,QAAQ,GAAG,CAAC,eAAe,GAAGK,QAAQC,MAAM,QAAQ;QAGxD,IAAI,CAAE,+BAA8BN,QAAQ,GAAE,GAC1CA,QAAQ,GAAG,CAAC,wBAAwB,GAAGF;IAE/C;AACJ;AAEO,MAAMS,gCAAgCC,iBAAiB,oBAAoB,CAAC;IAC/E,gBAAgBhB;IAChB,cAAc;QACViB;QACAC;QACAC;QACAC;KACH;AACL"}
1
+ {"version":3,"file":"extensions/Project/SetAdminAppEnvVarsBeforeBuild.js","sources":["../../../src/extensions/Project/SetAdminAppEnvVarsBeforeBuild.ts"],"sourcesContent":["import {\n AdminBeforeBuild,\n GetProjectIdService,\n GetProjectInstallationIdService,\n GetProjectVersionService,\n IsTelemetryEnabled\n} from \"~/abstractions/index.js\";\nimport { globalConfig } from \"@webiny/global-config\";\nimport { isCI } from \"ci-info\";\n\nclass SetAdminAppEnvVarsBeforeBuildImpl implements AdminBeforeBuild.Interface {\n constructor(\n private isTelemetryEnabled: IsTelemetryEnabled.Interface,\n private getProjectIdService: GetProjectIdService.Interface,\n private getProjectInstallationIdService: GetProjectInstallationIdService.Interface,\n private getProjectVersionService: GetProjectVersionService.Interface\n ) {}\n\n async execute() {\n const projectId = await this.getProjectIdService.execute();\n const projectVersion = this.getProjectVersionService.execute();\n\n const telemetry = await this.isTelemetryEnabled.execute();\n\n if (projectId) {\n process.env.REACT_APP_WEBINY_PROJECT_ID = projectId;\n process.env.REACT_APP_WCP_PROJECT_ID = projectId;\n }\n\n if (!(\"REACT_APP_WEBINY_INSTALLATION_ID\" in process.env)) {\n const installationId = this.getProjectInstallationIdService.execute();\n if (installationId) {\n process.env.REACT_APP_WEBINY_INSTALLATION_ID = installationId;\n }\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY\" in process.env)) {\n process.env.REACT_APP_WEBINY_TELEMETRY = String(telemetry);\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY_USER_ID\" in process.env)) {\n process.env.REACT_APP_WEBINY_TELEMETRY_USER_ID = globalConfig.get(\"id\");\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY_NEW_USER\" in process.env)) {\n const newUser = Boolean(globalConfig.get(\"newUser\")).toString();\n process.env.REACT_APP_WEBINY_TELEMETRY_NEW_USER = newUser;\n }\n\n // Mirror the hosting-type marker set by the CLI bin into the admin bundle, so admin events\n // can be segmented by hosting type the same way CLI events are.\n if (!(\"REACT_APP_WEBINY_HOSTING_TYPE\" in process.env) && process.env.WEBINY_HOSTING_TYPE) {\n process.env.REACT_APP_WEBINY_HOSTING_TYPE = process.env.WEBINY_HOSTING_TYPE;\n }\n\n if (!(\"INLINE_RUNTIME_CHUNK\" in process.env)) {\n process.env.INLINE_RUNTIME_CHUNK = \"true\";\n }\n\n if (!(\"REACT_APP_IS_CI\" in process.env)) {\n process.env.REACT_APP_IS_CI = Boolean(isCI).toString();\n }\n\n if (!(\"REACT_APP_WEBINY_VERSION\" in process.env)) {\n process.env.REACT_APP_WEBINY_VERSION = projectVersion;\n }\n }\n}\n\nexport const SetAdminAppEnvVarsBeforeBuild = AdminBeforeBuild.createImplementation({\n implementation: SetAdminAppEnvVarsBeforeBuildImpl,\n dependencies: [\n IsTelemetryEnabled,\n GetProjectIdService,\n GetProjectInstallationIdService,\n GetProjectVersionService\n ]\n});\n"],"names":["SetAdminAppEnvVarsBeforeBuildImpl","isTelemetryEnabled","getProjectIdService","getProjectInstallationIdService","getProjectVersionService","projectId","projectVersion","telemetry","process","installationId","String","globalConfig","newUser","Boolean","isCI","SetAdminAppEnvVarsBeforeBuild","AdminBeforeBuild","IsTelemetryEnabled","GetProjectIdService","GetProjectInstallationIdService","GetProjectVersionService"],"mappings":";;;AAUA,MAAMA;IACF,YACYC,kBAAgD,EAChDC,mBAAkD,EAClDC,+BAA0E,EAC1EC,wBAA4D,CACtE;aAJUH,kBAAkB,GAAlBA;aACAC,mBAAmB,GAAnBA;aACAC,+BAA+B,GAA/BA;aACAC,wBAAwB,GAAxBA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,YAAY,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QACxD,MAAMC,iBAAiB,IAAI,CAAC,wBAAwB,CAAC,OAAO;QAE5D,MAAMC,YAAY,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO;QAEvD,IAAIF,WAAW;YACXG,QAAQ,GAAG,CAAC,2BAA2B,GAAGH;YAC1CG,QAAQ,GAAG,CAAC,wBAAwB,GAAGH;QAC3C;QAEA,IAAI,CAAE,uCAAsCG,QAAQ,GAAE,GAAI;YACtD,MAAMC,iBAAiB,IAAI,CAAC,+BAA+B,CAAC,OAAO;YACnE,IAAIA,gBACAD,QAAQ,GAAG,CAAC,gCAAgC,GAAGC;QAEvD;QAEA,IAAI,CAAE,iCAAgCD,QAAQ,GAAE,GAC5CA,QAAQ,GAAG,CAAC,0BAA0B,GAAGE,OAAOH;QAGpD,IAAI,CAAE,yCAAwCC,QAAQ,GAAE,GACpDA,QAAQ,GAAG,CAAC,kCAAkC,GAAGG,aAAa,GAAG,CAAC;QAGtE,IAAI,CAAE,0CAAyCH,QAAQ,GAAE,GAAI;YACzD,MAAMI,UAAUC,QAAQF,aAAa,GAAG,CAAC,YAAY,QAAQ;YAC7DH,QAAQ,GAAG,CAAC,mCAAmC,GAAGI;QACtD;QAIA,IAAI,CAAE,oCAAmCJ,QAAQ,GAAE,KAAMA,QAAQ,GAAG,CAAC,mBAAmB,EACpFA,QAAQ,GAAG,CAAC,6BAA6B,GAAGA,QAAQ,GAAG,CAAC,mBAAmB;QAG/E,IAAI,CAAE,2BAA0BA,QAAQ,GAAE,GACtCA,QAAQ,GAAG,CAAC,oBAAoB,GAAG;QAGvC,IAAI,CAAE,sBAAqBA,QAAQ,GAAE,GACjCA,QAAQ,GAAG,CAAC,eAAe,GAAGK,QAAQC,MAAM,QAAQ;QAGxD,IAAI,CAAE,+BAA8BN,QAAQ,GAAE,GAC1CA,QAAQ,GAAG,CAAC,wBAAwB,GAAGF;IAE/C;AACJ;AAEO,MAAMS,gCAAgCC,iBAAiB,oBAAoB,CAAC;IAC/E,gBAAgBhB;IAChB,cAAc;QACViB;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -26,6 +26,7 @@ class SetAdminAppEnvVarsBeforeWatchImpl {
26
26
  const newUser = Boolean(globalConfig.get("newUser")).toString();
27
27
  process.env.REACT_APP_WEBINY_TELEMETRY_NEW_USER = newUser;
28
28
  }
29
+ if (!("REACT_APP_WEBINY_HOSTING_TYPE" in process.env) && process.env.WEBINY_HOSTING_TYPE) process.env.REACT_APP_WEBINY_HOSTING_TYPE = process.env.WEBINY_HOSTING_TYPE;
29
30
  if (!("INLINE_RUNTIME_CHUNK" in process.env)) process.env.INLINE_RUNTIME_CHUNK = "true";
30
31
  if (!("REACT_APP_IS_CI" in process.env)) process.env.REACT_APP_IS_CI = Boolean(isCI).toString();
31
32
  if (!("REACT_APP_WEBINY_VERSION" in process.env)) process.env.REACT_APP_WEBINY_VERSION = projectVersion;
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Project/SetAdminAppEnvVarsBeforeWatch.js","sources":["../../../src/extensions/Project/SetAdminAppEnvVarsBeforeWatch.ts"],"sourcesContent":["import {\n AdminBeforeWatch,\n IsTelemetryEnabled,\n GetProjectIdService,\n GetProjectInstallationIdService,\n GetProjectVersionService\n} from \"~/abstractions/index.js\";\nimport { globalConfig } from \"@webiny/global-config\";\nimport { isCI } from \"ci-info\";\n\nclass SetAdminAppEnvVarsBeforeWatchImpl implements AdminBeforeWatch.Interface {\n constructor(\n private isTelemetryEnabled: IsTelemetryEnabled.Interface,\n private getProjectIdService: GetProjectIdService.Interface,\n private getProjectInstallationIdService: GetProjectInstallationIdService.Interface,\n private getProjectVersionService: GetProjectVersionService.Interface\n ) {}\n\n async execute() {\n const projectId = await this.getProjectIdService.execute();\n const projectVersion = this.getProjectVersionService.execute();\n\n const telemetry = await this.isTelemetryEnabled.execute();\n\n if (projectId) {\n process.env.REACT_APP_WEBINY_PROJECT_ID = projectId;\n process.env.REACT_APP_WCP_PROJECT_ID = projectId;\n }\n\n if (!(\"REACT_APP_WEBINY_INSTALLATION_ID\" in process.env)) {\n const installationId = this.getProjectInstallationIdService.execute();\n if (installationId) {\n process.env.REACT_APP_WEBINY_INSTALLATION_ID = installationId;\n }\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY\" in process.env)) {\n process.env.REACT_APP_WEBINY_TELEMETRY = String(telemetry);\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY_USER_ID\" in process.env)) {\n process.env.REACT_APP_WEBINY_TELEMETRY_USER_ID = globalConfig.get(\"id\");\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY_NEW_USER\" in process.env)) {\n const newUser = Boolean(globalConfig.get(\"newUser\")).toString();\n process.env.REACT_APP_WEBINY_TELEMETRY_NEW_USER = newUser;\n }\n\n if (!(\"INLINE_RUNTIME_CHUNK\" in process.env)) {\n process.env.INLINE_RUNTIME_CHUNK = \"true\";\n }\n\n if (!(\"REACT_APP_IS_CI\" in process.env)) {\n process.env.REACT_APP_IS_CI = Boolean(isCI).toString();\n }\n\n if (!(\"REACT_APP_WEBINY_VERSION\" in process.env)) {\n process.env.REACT_APP_WEBINY_VERSION = projectVersion;\n }\n }\n}\n\nexport const SetAdminAppEnvVarsBeforeWatch = AdminBeforeWatch.createImplementation({\n implementation: SetAdminAppEnvVarsBeforeWatchImpl,\n dependencies: [\n IsTelemetryEnabled,\n GetProjectIdService,\n GetProjectInstallationIdService,\n GetProjectVersionService\n ]\n});\n"],"names":["SetAdminAppEnvVarsBeforeWatchImpl","isTelemetryEnabled","getProjectIdService","getProjectInstallationIdService","getProjectVersionService","projectId","projectVersion","telemetry","process","installationId","String","globalConfig","newUser","Boolean","isCI","SetAdminAppEnvVarsBeforeWatch","AdminBeforeWatch","IsTelemetryEnabled","GetProjectIdService","GetProjectInstallationIdService","GetProjectVersionService"],"mappings":";;;AAUA,MAAMA;IACF,YACYC,kBAAgD,EAChDC,mBAAkD,EAClDC,+BAA0E,EAC1EC,wBAA4D,CACtE;aAJUH,kBAAkB,GAAlBA;aACAC,mBAAmB,GAAnBA;aACAC,+BAA+B,GAA/BA;aACAC,wBAAwB,GAAxBA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,YAAY,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QACxD,MAAMC,iBAAiB,IAAI,CAAC,wBAAwB,CAAC,OAAO;QAE5D,MAAMC,YAAY,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO;QAEvD,IAAIF,WAAW;YACXG,QAAQ,GAAG,CAAC,2BAA2B,GAAGH;YAC1CG,QAAQ,GAAG,CAAC,wBAAwB,GAAGH;QAC3C;QAEA,IAAI,CAAE,uCAAsCG,QAAQ,GAAE,GAAI;YACtD,MAAMC,iBAAiB,IAAI,CAAC,+BAA+B,CAAC,OAAO;YACnE,IAAIA,gBACAD,QAAQ,GAAG,CAAC,gCAAgC,GAAGC;QAEvD;QAEA,IAAI,CAAE,iCAAgCD,QAAQ,GAAE,GAC5CA,QAAQ,GAAG,CAAC,0BAA0B,GAAGE,OAAOH;QAGpD,IAAI,CAAE,yCAAwCC,QAAQ,GAAE,GACpDA,QAAQ,GAAG,CAAC,kCAAkC,GAAGG,aAAa,GAAG,CAAC;QAGtE,IAAI,CAAE,0CAAyCH,QAAQ,GAAE,GAAI;YACzD,MAAMI,UAAUC,QAAQF,aAAa,GAAG,CAAC,YAAY,QAAQ;YAC7DH,QAAQ,GAAG,CAAC,mCAAmC,GAAGI;QACtD;QAEA,IAAI,CAAE,2BAA0BJ,QAAQ,GAAE,GACtCA,QAAQ,GAAG,CAAC,oBAAoB,GAAG;QAGvC,IAAI,CAAE,sBAAqBA,QAAQ,GAAE,GACjCA,QAAQ,GAAG,CAAC,eAAe,GAAGK,QAAQC,MAAM,QAAQ;QAGxD,IAAI,CAAE,+BAA8BN,QAAQ,GAAE,GAC1CA,QAAQ,GAAG,CAAC,wBAAwB,GAAGF;IAE/C;AACJ;AAEO,MAAMS,gCAAgCC,iBAAiB,oBAAoB,CAAC;IAC/E,gBAAgBhB;IAChB,cAAc;QACViB;QACAC;QACAC;QACAC;KACH;AACL"}
1
+ {"version":3,"file":"extensions/Project/SetAdminAppEnvVarsBeforeWatch.js","sources":["../../../src/extensions/Project/SetAdminAppEnvVarsBeforeWatch.ts"],"sourcesContent":["import {\n AdminBeforeWatch,\n IsTelemetryEnabled,\n GetProjectIdService,\n GetProjectInstallationIdService,\n GetProjectVersionService\n} from \"~/abstractions/index.js\";\nimport { globalConfig } from \"@webiny/global-config\";\nimport { isCI } from \"ci-info\";\n\nclass SetAdminAppEnvVarsBeforeWatchImpl implements AdminBeforeWatch.Interface {\n constructor(\n private isTelemetryEnabled: IsTelemetryEnabled.Interface,\n private getProjectIdService: GetProjectIdService.Interface,\n private getProjectInstallationIdService: GetProjectInstallationIdService.Interface,\n private getProjectVersionService: GetProjectVersionService.Interface\n ) {}\n\n async execute() {\n const projectId = await this.getProjectIdService.execute();\n const projectVersion = this.getProjectVersionService.execute();\n\n const telemetry = await this.isTelemetryEnabled.execute();\n\n if (projectId) {\n process.env.REACT_APP_WEBINY_PROJECT_ID = projectId;\n process.env.REACT_APP_WCP_PROJECT_ID = projectId;\n }\n\n if (!(\"REACT_APP_WEBINY_INSTALLATION_ID\" in process.env)) {\n const installationId = this.getProjectInstallationIdService.execute();\n if (installationId) {\n process.env.REACT_APP_WEBINY_INSTALLATION_ID = installationId;\n }\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY\" in process.env)) {\n process.env.REACT_APP_WEBINY_TELEMETRY = String(telemetry);\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY_USER_ID\" in process.env)) {\n process.env.REACT_APP_WEBINY_TELEMETRY_USER_ID = globalConfig.get(\"id\");\n }\n\n if (!(\"REACT_APP_WEBINY_TELEMETRY_NEW_USER\" in process.env)) {\n const newUser = Boolean(globalConfig.get(\"newUser\")).toString();\n process.env.REACT_APP_WEBINY_TELEMETRY_NEW_USER = newUser;\n }\n\n // Mirror the hosting-type marker set by the CLI bin into the admin bundle, so admin events\n // can be segmented by hosting type the same way CLI events are.\n if (!(\"REACT_APP_WEBINY_HOSTING_TYPE\" in process.env) && process.env.WEBINY_HOSTING_TYPE) {\n process.env.REACT_APP_WEBINY_HOSTING_TYPE = process.env.WEBINY_HOSTING_TYPE;\n }\n\n if (!(\"INLINE_RUNTIME_CHUNK\" in process.env)) {\n process.env.INLINE_RUNTIME_CHUNK = \"true\";\n }\n\n if (!(\"REACT_APP_IS_CI\" in process.env)) {\n process.env.REACT_APP_IS_CI = Boolean(isCI).toString();\n }\n\n if (!(\"REACT_APP_WEBINY_VERSION\" in process.env)) {\n process.env.REACT_APP_WEBINY_VERSION = projectVersion;\n }\n }\n}\n\nexport const SetAdminAppEnvVarsBeforeWatch = AdminBeforeWatch.createImplementation({\n implementation: SetAdminAppEnvVarsBeforeWatchImpl,\n dependencies: [\n IsTelemetryEnabled,\n GetProjectIdService,\n GetProjectInstallationIdService,\n GetProjectVersionService\n ]\n});\n"],"names":["SetAdminAppEnvVarsBeforeWatchImpl","isTelemetryEnabled","getProjectIdService","getProjectInstallationIdService","getProjectVersionService","projectId","projectVersion","telemetry","process","installationId","String","globalConfig","newUser","Boolean","isCI","SetAdminAppEnvVarsBeforeWatch","AdminBeforeWatch","IsTelemetryEnabled","GetProjectIdService","GetProjectInstallationIdService","GetProjectVersionService"],"mappings":";;;AAUA,MAAMA;IACF,YACYC,kBAAgD,EAChDC,mBAAkD,EAClDC,+BAA0E,EAC1EC,wBAA4D,CACtE;aAJUH,kBAAkB,GAAlBA;aACAC,mBAAmB,GAAnBA;aACAC,+BAA+B,GAA/BA;aACAC,wBAAwB,GAAxBA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,YAAY,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QACxD,MAAMC,iBAAiB,IAAI,CAAC,wBAAwB,CAAC,OAAO;QAE5D,MAAMC,YAAY,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO;QAEvD,IAAIF,WAAW;YACXG,QAAQ,GAAG,CAAC,2BAA2B,GAAGH;YAC1CG,QAAQ,GAAG,CAAC,wBAAwB,GAAGH;QAC3C;QAEA,IAAI,CAAE,uCAAsCG,QAAQ,GAAE,GAAI;YACtD,MAAMC,iBAAiB,IAAI,CAAC,+BAA+B,CAAC,OAAO;YACnE,IAAIA,gBACAD,QAAQ,GAAG,CAAC,gCAAgC,GAAGC;QAEvD;QAEA,IAAI,CAAE,iCAAgCD,QAAQ,GAAE,GAC5CA,QAAQ,GAAG,CAAC,0BAA0B,GAAGE,OAAOH;QAGpD,IAAI,CAAE,yCAAwCC,QAAQ,GAAE,GACpDA,QAAQ,GAAG,CAAC,kCAAkC,GAAGG,aAAa,GAAG,CAAC;QAGtE,IAAI,CAAE,0CAAyCH,QAAQ,GAAE,GAAI;YACzD,MAAMI,UAAUC,QAAQF,aAAa,GAAG,CAAC,YAAY,QAAQ;YAC7DH,QAAQ,GAAG,CAAC,mCAAmC,GAAGI;QACtD;QAIA,IAAI,CAAE,oCAAmCJ,QAAQ,GAAE,KAAMA,QAAQ,GAAG,CAAC,mBAAmB,EACpFA,QAAQ,GAAG,CAAC,6BAA6B,GAAGA,QAAQ,GAAG,CAAC,mBAAmB;QAG/E,IAAI,CAAE,2BAA0BA,QAAQ,GAAE,GACtCA,QAAQ,GAAG,CAAC,oBAAoB,GAAG;QAGvC,IAAI,CAAE,sBAAqBA,QAAQ,GAAE,GACjCA,QAAQ,GAAG,CAAC,eAAe,GAAGK,QAAQC,MAAM,QAAQ;QAGxD,IAAI,CAAE,+BAA8BN,QAAQ,GAAE,GAC1CA,QAAQ,GAAG,CAAC,wBAAwB,GAAGF;IAE/C;AACJ;AAEO,MAAMS,gCAAgCC,iBAAiB,oBAAoB,CAAC;IAC/E,gBAAgBhB;IAChB,cAAc;QACViB;QACAC;QACAC;QACAC;KACH;AACL"}
@@ -1,10 +1,11 @@
1
1
  import { AdminBeforeWatch, UiService } from "../../abstractions/index.js";
2
+ import { showConfigChangeNotice } from "./showConfigChangeNotice.js";
2
3
  class ShowConfigChangeInfoBeforeAdminWatchImpl {
3
4
  constructor(ui){
4
5
  this.ui = ui;
5
6
  }
6
7
  async execute() {
7
- this.ui.info("Changes done in %s are not reloaded automatically. You'll have to restart the watch command in order for your changes to take effect.", "webiny.config.tsx");
8
+ showConfigChangeNotice(this.ui);
8
9
  }
9
10
  }
10
11
  const ShowConfigChangeInfoBeforeAdminWatch = AdminBeforeWatch.createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Project/ShowConfigChangeInfoBeforeAdminWatch.js","sources":["../../../src/extensions/Project/ShowConfigChangeInfoBeforeAdminWatch.ts"],"sourcesContent":["import { AdminBeforeWatch, UiService } from \"~/abstractions/index.js\";\n\nclass ShowConfigChangeInfoBeforeAdminWatchImpl implements AdminBeforeWatch.Interface {\n constructor(private ui: UiService.Interface) {}\n\n async execute() {\n this.ui.info(\n [\n \"Changes done in %s are not reloaded automatically.\",\n \"You'll have to restart the watch command in order for your changes to take effect.\"\n ].join(\" \"),\n \"webiny.config.tsx\"\n );\n }\n}\n\nexport const ShowConfigChangeInfoBeforeAdminWatch = AdminBeforeWatch.createImplementation({\n implementation: ShowConfigChangeInfoBeforeAdminWatchImpl,\n dependencies: [UiService]\n});\n"],"names":["ShowConfigChangeInfoBeforeAdminWatchImpl","ui","ShowConfigChangeInfoBeforeAdminWatch","AdminBeforeWatch","UiService"],"mappings":";AAEA,MAAMA;IACF,YAAoBC,EAAuB,CAAE;aAAzBA,EAAE,GAAFA;IAA0B;IAE9C,MAAM,UAAU;QACZ,IAAI,CAAC,EAAE,CAAC,IAAI,CACR,yIAIA;IAER;AACJ;AAEO,MAAMC,uCAAuCC,iBAAiB,oBAAoB,CAAC;IACtF,gBAAgBH;IAChB,cAAc;QAACI;KAAU;AAC7B"}
1
+ {"version":3,"file":"extensions/Project/ShowConfigChangeInfoBeforeAdminWatch.js","sources":["../../../src/extensions/Project/ShowConfigChangeInfoBeforeAdminWatch.ts"],"sourcesContent":["import { AdminBeforeWatch, UiService } from \"~/abstractions/index.js\";\nimport { showConfigChangeNotice } from \"./showConfigChangeNotice.js\";\n\nclass ShowConfigChangeInfoBeforeAdminWatchImpl implements AdminBeforeWatch.Interface {\n constructor(private ui: UiService.Interface) {}\n\n async execute() {\n showConfigChangeNotice(this.ui);\n }\n}\n\nexport const ShowConfigChangeInfoBeforeAdminWatch = AdminBeforeWatch.createImplementation({\n implementation: ShowConfigChangeInfoBeforeAdminWatchImpl,\n dependencies: [UiService]\n});\n"],"names":["ShowConfigChangeInfoBeforeAdminWatchImpl","ui","showConfigChangeNotice","ShowConfigChangeInfoBeforeAdminWatch","AdminBeforeWatch","UiService"],"mappings":";;AAGA,MAAMA;IACF,YAAoBC,EAAuB,CAAE;aAAzBA,EAAE,GAAFA;IAA0B;IAE9C,MAAM,UAAU;QACZC,uBAAuB,IAAI,CAAC,EAAE;IAClC;AACJ;AAEO,MAAMC,uCAAuCC,iBAAiB,oBAAoB,CAAC;IACtF,gBAAgBJ;IAChB,cAAc;QAACK;KAAU;AAC7B"}
@@ -1,10 +1,11 @@
1
1
  import { ApiBeforeWatch, UiService } from "../../abstractions/index.js";
2
+ import { showConfigChangeNotice } from "./showConfigChangeNotice.js";
2
3
  class ShowConfigChangeInfoBeforeApiWatchImpl {
3
4
  constructor(ui){
4
5
  this.ui = ui;
5
6
  }
6
7
  async execute() {
7
- this.ui.info("Changes done in %s are not reloaded automatically. You'll have to restart the watch command in order for your changes to take effect.", "webiny.config.tsx");
8
+ showConfigChangeNotice(this.ui);
8
9
  }
9
10
  }
10
11
  const ShowConfigChangeInfoBeforeApiWatch = ApiBeforeWatch.createImplementation({
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Project/ShowConfigChangeInfoBeforeApiWatch.js","sources":["../../../src/extensions/Project/ShowConfigChangeInfoBeforeApiWatch.ts"],"sourcesContent":["import { ApiBeforeWatch, UiService } from \"~/abstractions/index.js\";\n\nclass ShowConfigChangeInfoBeforeApiWatchImpl implements ApiBeforeWatch.Interface {\n constructor(private ui: UiService.Interface) {}\n\n async execute() {\n this.ui.info(\n [\n \"Changes done in %s are not reloaded automatically.\",\n \"You'll have to restart the watch command in order for your changes to take effect.\"\n ].join(\" \"),\n \"webiny.config.tsx\"\n );\n }\n}\n\nexport const ShowConfigChangeInfoBeforeApiWatch = ApiBeforeWatch.createImplementation({\n implementation: ShowConfigChangeInfoBeforeApiWatchImpl,\n dependencies: [UiService]\n});\n"],"names":["ShowConfigChangeInfoBeforeApiWatchImpl","ui","ShowConfigChangeInfoBeforeApiWatch","ApiBeforeWatch","UiService"],"mappings":";AAEA,MAAMA;IACF,YAAoBC,EAAuB,CAAE;aAAzBA,EAAE,GAAFA;IAA0B;IAE9C,MAAM,UAAU;QACZ,IAAI,CAAC,EAAE,CAAC,IAAI,CACR,yIAIA;IAER;AACJ;AAEO,MAAMC,qCAAqCC,eAAe,oBAAoB,CAAC;IAClF,gBAAgBH;IAChB,cAAc;QAACI;KAAU;AAC7B"}
1
+ {"version":3,"file":"extensions/Project/ShowConfigChangeInfoBeforeApiWatch.js","sources":["../../../src/extensions/Project/ShowConfigChangeInfoBeforeApiWatch.ts"],"sourcesContent":["import { ApiBeforeWatch, UiService } from \"~/abstractions/index.js\";\nimport { showConfigChangeNotice } from \"./showConfigChangeNotice.js\";\n\nclass ShowConfigChangeInfoBeforeApiWatchImpl implements ApiBeforeWatch.Interface {\n constructor(private ui: UiService.Interface) {}\n\n async execute() {\n showConfigChangeNotice(this.ui);\n }\n}\n\nexport const ShowConfigChangeInfoBeforeApiWatch = ApiBeforeWatch.createImplementation({\n implementation: ShowConfigChangeInfoBeforeApiWatchImpl,\n dependencies: [UiService]\n});\n"],"names":["ShowConfigChangeInfoBeforeApiWatchImpl","ui","showConfigChangeNotice","ShowConfigChangeInfoBeforeApiWatch","ApiBeforeWatch","UiService"],"mappings":";;AAGA,MAAMA;IACF,YAAoBC,EAAuB,CAAE;aAAzBA,EAAE,GAAFA;IAA0B;IAE9C,MAAM,UAAU;QACZC,uBAAuB,IAAI,CAAC,EAAE;IAClC;AACJ;AAEO,MAAMC,qCAAqCC,eAAe,oBAAoB,CAAC;IAClF,gBAAgBJ;IAChB,cAAc;QAACK;KAAU;AAC7B"}
@@ -24,12 +24,13 @@ class WcpInjectTelemetryClientAfterBuildImpl {
24
24
  const response = await fetch(latestTelemetryClientUrl);
25
25
  if (!response.ok) throw new Error(`Failed to download telemetry client: ${response.status} - ${response.statusText}`);
26
26
  const telemetryCodeAsString = await response.text();
27
+ const wrapperCode = telemetryCodeAsString + '\nimport * as _webinyBuiltHandlers from "./_handler.mjs";\nexport const streamHandler = _webinyBuiltHandlers.streamHandler;\n';
27
28
  for(let i = 0; i < handlersPaths.length; i++){
28
29
  const current = handlersPaths[i];
29
30
  const builtHandlerPath = current.join("handler.mjs").toString();
30
31
  const renamedHandlerPath = current.join("_handler.mjs").toString();
31
32
  fs.renameSync(builtHandlerPath, renamedHandlerPath);
32
- fs.writeFileSync(builtHandlerPath, telemetryCodeAsString);
33
+ fs.writeFileSync(builtHandlerPath, wrapperCode);
33
34
  }
34
35
  logger.info("WCP telemetry client injected successfully.");
35
36
  } catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Project/WcpInjectTelemetryClientAfterBuild.js","sources":["../../../src/extensions/Project/WcpInjectTelemetryClientAfterBuild.ts"],"sourcesContent":["import {\n ApiAfterBuild,\n GetApp,\n GetProjectIdService,\n LoggerService,\n UiService,\n WcpService\n} from \"~/abstractions/index.js\";\nimport fs from \"fs\";\n\nclass WcpInjectTelemetryClientAfterBuildImpl implements ApiAfterBuild.Interface {\n constructor(\n private getProjectIdService: GetProjectIdService.Interface,\n private wcpService: WcpService.Interface,\n private loggerService: LoggerService.Interface,\n private getApp: GetApp.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute() {\n const projectId = await this.getProjectIdService.execute();\n if (!projectId) {\n return;\n }\n\n const logger = this.loggerService;\n const ui = this.uiService;\n\n logger.info(\"Injecting WCP telemetry client into the GraphQL API handler...\");\n\n const app = this.getApp.execute(\"api\");\n\n // Only wrap the GraphQL API handler with the telemetry client.\n const handlersPaths = [app.paths.workspaceFolder.join(\"graphql\", \"build\")];\n\n // 1. Download telemetry client code.\n const latestTelemetryClientUrl = this.wcpService\n .getWcpApiUrl()\n .join(\"/clients/latest.mjs\")\n .toString();\n\n try {\n logger.info(`Downloading telemetry client from: ${latestTelemetryClientUrl}`);\n const response = await fetch(latestTelemetryClientUrl);\n if (!response.ok) {\n throw new Error(\n `Failed to download telemetry client: ${response.status} - ${response.statusText}`\n );\n }\n\n const telemetryCodeAsString = await response.text();\n\n // 2. Wrap the initially built code with the telemetry client code.\n for (let i = 0; i < handlersPaths.length; i++) {\n const current = handlersPaths[i];\n\n // 2.1 Move initially built `handler.mjs` into `_handler.mjs`.\n const builtHandlerPath = current.join(\"handler.mjs\").toString();\n const renamedHandlerPath = current.join(\"_handler.mjs\").toString();\n fs.renameSync(builtHandlerPath, renamedHandlerPath);\n\n // 2.2 Write downloaded telemetry client code as a new `handler.js`.\n fs.writeFileSync(builtHandlerPath, telemetryCodeAsString);\n }\n\n logger.info(\"WCP telemetry client injected successfully.\");\n } catch (err) {\n logger.debug({ err }, \"WCP client is unavailable; telemetry was disabled.\");\n ui.warning(`WCP client is unavailable; telemetry was disabled.`);\n }\n }\n}\n\nexport const WcpInjectTelemetryClientAfterBuild = ApiAfterBuild.createImplementation({\n implementation: WcpInjectTelemetryClientAfterBuildImpl,\n dependencies: [GetProjectIdService, WcpService, LoggerService, GetApp, UiService]\n});\n"],"names":["WcpInjectTelemetryClientAfterBuildImpl","getProjectIdService","wcpService","loggerService","getApp","uiService","projectId","logger","ui","app","handlersPaths","latestTelemetryClientUrl","response","fetch","Error","telemetryCodeAsString","i","current","builtHandlerPath","renamedHandlerPath","fs","err","WcpInjectTelemetryClientAfterBuild","ApiAfterBuild","GetProjectIdService","WcpService","LoggerService","GetApp","UiService"],"mappings":";;AAUA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,UAAgC,EAChCC,aAAsC,EACtCC,MAAwB,EACxBC,SAA8B,CACxC;aALUJ,mBAAmB,GAAnBA;aACAC,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,YAAY,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QACxD,IAAI,CAACA,WACD;QAGJ,MAAMC,SAAS,IAAI,CAAC,aAAa;QACjC,MAAMC,KAAK,IAAI,CAAC,SAAS;QAEzBD,OAAO,IAAI,CAAC;QAEZ,MAAME,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAGhC,MAAMC,gBAAgB;YAACD,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW;SAAS;QAG1E,MAAME,2BAA2B,IAAI,CAAC,UAAU,CAC3C,YAAY,GACZ,IAAI,CAAC,uBACL,QAAQ;QAEb,IAAI;YACAJ,OAAO,IAAI,CAAC,CAAC,mCAAmC,EAAEI,0BAA0B;YAC5E,MAAMC,WAAW,MAAMC,MAAMF;YAC7B,IAAI,CAACC,SAAS,EAAE,EACZ,MAAM,IAAIE,MACN,CAAC,qCAAqC,EAAEF,SAAS,MAAM,CAAC,GAAG,EAAEA,SAAS,UAAU,EAAE;YAI1F,MAAMG,wBAAwB,MAAMH,SAAS,IAAI;YAGjD,IAAK,IAAII,IAAI,GAAGA,IAAIN,cAAc,MAAM,EAAEM,IAAK;gBAC3C,MAAMC,UAAUP,aAAa,CAACM,EAAE;gBAGhC,MAAME,mBAAmBD,QAAQ,IAAI,CAAC,eAAe,QAAQ;gBAC7D,MAAME,qBAAqBF,QAAQ,IAAI,CAAC,gBAAgB,QAAQ;gBAChEG,GAAG,UAAU,CAACF,kBAAkBC;gBAGhCC,GAAG,aAAa,CAACF,kBAAkBH;YACvC;YAEAR,OAAO,IAAI,CAAC;QAChB,EAAE,OAAOc,KAAK;YACVd,OAAO,KAAK,CAAC;gBAAEc;YAAI,GAAG;YACtBb,GAAG,OAAO,CAAC;QACf;IACJ;AACJ;AAEO,MAAMc,qCAAqCC,cAAc,oBAAoB,CAAC;IACjF,gBAAgBvB;IAChB,cAAc;QAACwB;QAAqBC;QAAYC;QAAeC;QAAQC;KAAU;AACrF"}
1
+ {"version":3,"file":"extensions/Project/WcpInjectTelemetryClientAfterBuild.js","sources":["../../../src/extensions/Project/WcpInjectTelemetryClientAfterBuild.ts"],"sourcesContent":["import {\n ApiAfterBuild,\n GetApp,\n GetProjectIdService,\n LoggerService,\n UiService,\n WcpService\n} from \"~/abstractions/index.js\";\nimport fs from \"fs\";\n\nclass WcpInjectTelemetryClientAfterBuildImpl implements ApiAfterBuild.Interface {\n constructor(\n private getProjectIdService: GetProjectIdService.Interface,\n private wcpService: WcpService.Interface,\n private loggerService: LoggerService.Interface,\n private getApp: GetApp.Interface,\n private uiService: UiService.Interface\n ) {}\n\n async execute() {\n const projectId = await this.getProjectIdService.execute();\n if (!projectId) {\n return;\n }\n\n const logger = this.loggerService;\n const ui = this.uiService;\n\n logger.info(\"Injecting WCP telemetry client into the GraphQL API handler...\");\n\n const app = this.getApp.execute(\"api\");\n\n // Only wrap the GraphQL API handler with the telemetry client.\n const handlersPaths = [app.paths.workspaceFolder.join(\"graphql\", \"build\")];\n\n // 1. Download telemetry client code.\n const latestTelemetryClientUrl = this.wcpService\n .getWcpApiUrl()\n .join(\"/clients/latest.mjs\")\n .toString();\n\n try {\n logger.info(`Downloading telemetry client from: ${latestTelemetryClientUrl}`);\n const response = await fetch(latestTelemetryClientUrl);\n if (!response.ok) {\n throw new Error(\n `Failed to download telemetry client: ${response.status} - ${response.statusText}`\n );\n }\n\n const telemetryCodeAsString = await response.text();\n\n // The downloaded wrapper re-exports only `handler`, but the AWS api bundle also exports\n // `streamHandler` — the entry point of the response-streaming Lambda. Without this\n // re-export that function has no handler to load and fails at cold start.\n //\n // Two constraints shape how it's done:\n //\n // 1. UNWRAPPED. `streamHandler` carries the marker `awslambda.streamifyResponse` attaches,\n // and the runtime inspects the exported function for it; routing it through a telemetry\n // wrapper function would strip the marker and silently downgrade the function to\n // buffered responses. Re-exporting the same function object keeps the marker — at the\n // cost of no telemetry for that function, which is the right trade.\n //\n // 2. Via a NAMESPACE import, not `export { streamHandler } from ...`. This injection also\n // runs for the standalone api build, whose bundle has no `streamHandler` (streaming is\n // native there, with no Lambda involved), and a named re-export of a missing binding is\n // a hard ESM error that would break the whole handler. A namespace access just yields\n // `undefined`, which nothing on that path reads.\n //\n // BACKLOGGED, not settled. String-appending to an artifact downloaded from another repo\n // means a change to the shape of `clients/latest.mjs` breaks the build on customers'\n // machines. The agreed fix is one line on the WCP side — `export * from \"./_handler.mjs\"`\n // right after that file's own import, which passes through every bundle export unwrapped\n // (the explicit `export { handler }` still shadows the star, and `export *` re-exports\n // nothing on the standalone bundle). When that ships, this whole append goes away.\n const wrapperCode =\n telemetryCodeAsString +\n '\\nimport * as _webinyBuiltHandlers from \"./_handler.mjs\";\\n' +\n \"export const streamHandler = _webinyBuiltHandlers.streamHandler;\\n\";\n\n // 2. Wrap the initially built code with the telemetry client code.\n for (let i = 0; i < handlersPaths.length; i++) {\n const current = handlersPaths[i];\n\n // 2.1 Move initially built `handler.mjs` into `_handler.mjs`.\n const builtHandlerPath = current.join(\"handler.mjs\").toString();\n const renamedHandlerPath = current.join(\"_handler.mjs\").toString();\n fs.renameSync(builtHandlerPath, renamedHandlerPath);\n\n // 2.2 Write downloaded telemetry client code as a new `handler.js`.\n fs.writeFileSync(builtHandlerPath, wrapperCode);\n }\n\n logger.info(\"WCP telemetry client injected successfully.\");\n } catch (err) {\n logger.debug({ err }, \"WCP client is unavailable; telemetry was disabled.\");\n ui.warning(`WCP client is unavailable; telemetry was disabled.`);\n }\n }\n}\n\nexport const WcpInjectTelemetryClientAfterBuild = ApiAfterBuild.createImplementation({\n implementation: WcpInjectTelemetryClientAfterBuildImpl,\n dependencies: [GetProjectIdService, WcpService, LoggerService, GetApp, UiService]\n});\n"],"names":["WcpInjectTelemetryClientAfterBuildImpl","getProjectIdService","wcpService","loggerService","getApp","uiService","projectId","logger","ui","app","handlersPaths","latestTelemetryClientUrl","response","fetch","Error","telemetryCodeAsString","wrapperCode","i","current","builtHandlerPath","renamedHandlerPath","fs","err","WcpInjectTelemetryClientAfterBuild","ApiAfterBuild","GetProjectIdService","WcpService","LoggerService","GetApp","UiService"],"mappings":";;AAUA,MAAMA;IACF,YACYC,mBAAkD,EAClDC,UAAgC,EAChCC,aAAsC,EACtCC,MAAwB,EACxBC,SAA8B,CACxC;aALUJ,mBAAmB,GAAnBA;aACAC,UAAU,GAAVA;aACAC,aAAa,GAAbA;aACAC,MAAM,GAANA;aACAC,SAAS,GAATA;IACT;IAEH,MAAM,UAAU;QACZ,MAAMC,YAAY,MAAM,IAAI,CAAC,mBAAmB,CAAC,OAAO;QACxD,IAAI,CAACA,WACD;QAGJ,MAAMC,SAAS,IAAI,CAAC,aAAa;QACjC,MAAMC,KAAK,IAAI,CAAC,SAAS;QAEzBD,OAAO,IAAI,CAAC;QAEZ,MAAME,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;QAGhC,MAAMC,gBAAgB;YAACD,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,WAAW;SAAS;QAG1E,MAAME,2BAA2B,IAAI,CAAC,UAAU,CAC3C,YAAY,GACZ,IAAI,CAAC,uBACL,QAAQ;QAEb,IAAI;YACAJ,OAAO,IAAI,CAAC,CAAC,mCAAmC,EAAEI,0BAA0B;YAC5E,MAAMC,WAAW,MAAMC,MAAMF;YAC7B,IAAI,CAACC,SAAS,EAAE,EACZ,MAAM,IAAIE,MACN,CAAC,qCAAqC,EAAEF,SAAS,MAAM,CAAC,GAAG,EAAEA,SAAS,UAAU,EAAE;YAI1F,MAAMG,wBAAwB,MAAMH,SAAS,IAAI;YA0BjD,MAAMI,cACFD,wBAAAA;YAKJ,IAAK,IAAIE,IAAI,GAAGA,IAAIP,cAAc,MAAM,EAAEO,IAAK;gBAC3C,MAAMC,UAAUR,aAAa,CAACO,EAAE;gBAGhC,MAAME,mBAAmBD,QAAQ,IAAI,CAAC,eAAe,QAAQ;gBAC7D,MAAME,qBAAqBF,QAAQ,IAAI,CAAC,gBAAgB,QAAQ;gBAChEG,GAAG,UAAU,CAACF,kBAAkBC;gBAGhCC,GAAG,aAAa,CAACF,kBAAkBH;YACvC;YAEAT,OAAO,IAAI,CAAC;QAChB,EAAE,OAAOe,KAAK;YACVf,OAAO,KAAK,CAAC;gBAAEe;YAAI,GAAG;YACtBd,GAAG,OAAO,CAAC;QACf;IACJ;AACJ;AAEO,MAAMe,qCAAqCC,cAAc,oBAAoB,CAAC;IACjF,gBAAgBxB;IAChB,cAAc;QAACyB;QAAqBC;QAAYC;QAAeC;QAAQC;KAAU;AACrF"}
@@ -0,0 +1,7 @@
1
+ import { type UiService } from "../../abstractions/index.js";
2
+ /**
3
+ * The "restart the watch command" notice is wired per app (`ApiBeforeWatch` + `AdminBeforeWatch`), but a
4
+ * single `webiny watch` can now cover several apps in one process — standalone watches api and admin
5
+ * together. The message is identical either way, so print it once per process instead of once per app.
6
+ */
7
+ export declare const showConfigChangeNotice: (ui: UiService.Interface) => void;
@@ -0,0 +1,9 @@
1
+ let shown = false;
2
+ const showConfigChangeNotice = (ui)=>{
3
+ if (shown) return;
4
+ shown = true;
5
+ ui.info("Changes done in %s are not reloaded automatically. You'll have to restart the watch command in order for your changes to take effect.", "webiny.config.tsx");
6
+ };
7
+ export { showConfigChangeNotice };
8
+
9
+ //# sourceMappingURL=showConfigChangeNotice.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions/Project/showConfigChangeNotice.js","sources":["../../../src/extensions/Project/showConfigChangeNotice.ts"],"sourcesContent":["import { type UiService } from \"~/abstractions/index.js\";\n\nlet shown = false;\n\n/**\n * The \"restart the watch command\" notice is wired per app (`ApiBeforeWatch` + `AdminBeforeWatch`), but a\n * single `webiny watch` can now cover several apps in one process — standalone watches api and admin\n * together. The message is identical either way, so print it once per process instead of once per app.\n */\nexport const showConfigChangeNotice = (ui: UiService.Interface) => {\n if (shown) {\n return;\n }\n\n shown = true;\n\n ui.info(\n [\n \"Changes done in %s are not reloaded automatically.\",\n \"You'll have to restart the watch command in order for your changes to take effect.\"\n ].join(\" \"),\n \"webiny.config.tsx\"\n );\n};\n"],"names":["shown","showConfigChangeNotice","ui"],"mappings":"AAEA,IAAIA,QAAQ;AAOL,MAAMC,yBAAyB,CAACC;IACnC,IAAIF,OACA;IAGJA,QAAQ;IAERE,GAAG,IAAI,CACH,yIAIA;AAER"}
@@ -1,6 +1,6 @@
1
1
  import react from "react";
2
2
  import { createPathResolver } from "../utils/createPathResolver.js";
3
- import { AdminAfterDeploy, AdminBeforeBuild, AdminBeforeWatch, ApiAfterBuild, ApiBeforeDeploy, ApiBeforeWatch, BeforeDeploy, CoreBeforeDeploy } from "./index.js";
3
+ import { AdminBeforeBuild, AdminBeforeWatch, ApiAfterBuild, ApiBeforeWatch } from "./index.js";
4
4
  const p = createPathResolver(import.meta.dirname, "Project");
5
5
  const Project = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(AdminBeforeBuild, {
6
6
  src: p("SetAdminAppEnvVarsBeforeBuild.js")
@@ -10,24 +10,8 @@ const Project = ()=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#_
10
10
  src: p("ShowConfigChangeInfoBeforeAdminWatch.js")
11
11
  }), /*#__PURE__*/ react.createElement(ApiAfterBuild, {
12
12
  src: p("WcpInjectTelemetryClientAfterBuild.js")
13
- }), /*#__PURE__*/ react.createElement(ApiBeforeDeploy, {
14
- src: p("EnsureCoreDeployedBeforeApiDeploy.js")
15
- }), /*#__PURE__*/ react.createElement(ApiBeforeWatch, {
16
- src: p("EnsureApiDeployedBeforeWatch.js")
17
13
  }), /*#__PURE__*/ react.createElement(ApiBeforeWatch, {
18
14
  src: p("ShowConfigChangeInfoBeforeApiWatch.js")
19
- }), /*#__PURE__*/ react.createElement(AdminBeforeBuild, {
20
- src: p("EnsureApiDeployedBeforeAdminBuild.js")
21
- }), /*#__PURE__*/ react.createElement(AdminBeforeWatch, {
22
- src: p("EnsureApiDeployedBeforeAdminWatch.js")
23
- }), /*#__PURE__*/ react.createElement(AdminAfterDeploy, {
24
- src: p("TelemetryNoLongerNewUser.js")
25
- }), /*#__PURE__*/ react.createElement(BeforeDeploy, {
26
- src: p("EnsureTelemetryEnabledForOss.js")
27
- }), /*#__PURE__*/ react.createElement(BeforeDeploy, {
28
- src: p("ValidateEncryptionBeforeDeploy.js")
29
- }), /*#__PURE__*/ react.createElement(CoreBeforeDeploy, {
30
- src: p("ValidateProductionPulumiState.js")
31
15
  }));
32
16
  export { Project };
33
17
 
@@ -1 +1 @@
1
- {"version":3,"file":"extensions/Project.js","sources":["../../src/extensions/Project.tsx"],"sourcesContent":["import React from \"react\";\nimport { createPathResolver } from \"~/utils/createPathResolver.js\";\nimport {\n AdminAfterDeploy,\n AdminBeforeBuild,\n AdminBeforeWatch,\n ApiAfterBuild,\n ApiBeforeDeploy,\n ApiBeforeWatch,\n BeforeDeploy,\n CoreBeforeDeploy\n} from \"~/extensions/index.js\";\n\nconst p = createPathResolver(import.meta.dirname, \"Project\");\n\nexport const Project = () => {\n return (\n <>\n <AdminBeforeBuild src={p(\"SetAdminAppEnvVarsBeforeBuild.js\")} />\n <AdminBeforeWatch src={p(\"SetAdminAppEnvVarsBeforeWatch.js\")} />\n <AdminBeforeWatch src={p(\"ShowConfigChangeInfoBeforeAdminWatch.js\")} />\n <ApiAfterBuild src={p(\"WcpInjectTelemetryClientAfterBuild.js\")} />\n <ApiBeforeDeploy src={p(\"EnsureCoreDeployedBeforeApiDeploy.js\")} />\n <ApiBeforeWatch src={p(\"EnsureApiDeployedBeforeWatch.js\")} />\n <ApiBeforeWatch src={p(\"ShowConfigChangeInfoBeforeApiWatch.js\")} />\n <AdminBeforeBuild src={p(\"EnsureApiDeployedBeforeAdminBuild.js\")} />\n <AdminBeforeWatch src={p(\"EnsureApiDeployedBeforeAdminWatch.js\")} />\n <AdminAfterDeploy src={p(\"TelemetryNoLongerNewUser.js\")} />\n <BeforeDeploy src={p(\"EnsureTelemetryEnabledForOss.js\")} />\n <BeforeDeploy src={p(\"ValidateEncryptionBeforeDeploy.js\")} />\n <CoreBeforeDeploy src={p(\"ValidateProductionPulumiState.js\")} />\n </>\n );\n};\n"],"names":["p","createPathResolver","Project","AdminBeforeBuild","AdminBeforeWatch","ApiAfterBuild","ApiBeforeDeploy","ApiBeforeWatch","AdminAfterDeploy","BeforeDeploy","CoreBeforeDeploy"],"mappings":";;;AAaA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO,EAAE;AAE3C,MAAMC,UAAU,IACZ,WAAP,GACI,wDACI,oBAACC,kBAAgBA;QAAC,KAAKH,EAAE;sBACzB,oBAACI,kBAAgBA;QAAC,KAAKJ,EAAE;sBACzB,oBAACI,kBAAgBA;QAAC,KAAKJ,EAAE;sBACzB,oBAACK,eAAaA;QAAC,KAAKL,EAAE;sBACtB,oBAACM,iBAAeA;QAAC,KAAKN,EAAE;sBACxB,oBAACO,gBAAcA;QAAC,KAAKP,EAAE;sBACvB,oBAACO,gBAAcA;QAAC,KAAKP,EAAE;sBACvB,oBAACG,kBAAgBA;QAAC,KAAKH,EAAE;sBACzB,oBAACI,kBAAgBA;QAAC,KAAKJ,EAAE;sBACzB,oBAACQ,kBAAgBA;QAAC,KAAKR,EAAE;sBACzB,oBAACS,cAAYA;QAAC,KAAKT,EAAE;sBACrB,oBAACS,cAAYA;QAAC,KAAKT,EAAE;sBACrB,oBAACU,kBAAgBA;QAAC,KAAKV,EAAE"}
1
+ {"version":3,"file":"extensions/Project.js","sources":["../../src/extensions/Project.tsx"],"sourcesContent":["import React from \"react\";\nimport { createPathResolver } from \"~/utils/createPathResolver.js\";\nimport {\n AdminBeforeBuild,\n AdminBeforeWatch,\n ApiAfterBuild,\n ApiBeforeWatch\n} from \"~/extensions/index.js\";\n\nconst p = createPathResolver(import.meta.dirname, \"Project\");\n\nexport const Project = () => {\n return (\n <>\n <AdminBeforeBuild src={p(\"SetAdminAppEnvVarsBeforeBuild.js\")} />\n <AdminBeforeWatch src={p(\"SetAdminAppEnvVarsBeforeWatch.js\")} />\n <AdminBeforeWatch src={p(\"ShowConfigChangeInfoBeforeAdminWatch.js\")} />\n <ApiAfterBuild src={p(\"WcpInjectTelemetryClientAfterBuild.js\")} />\n <ApiBeforeWatch src={p(\"ShowConfigChangeInfoBeforeApiWatch.js\")} />\n </>\n );\n};\n"],"names":["p","createPathResolver","Project","AdminBeforeBuild","AdminBeforeWatch","ApiAfterBuild","ApiBeforeWatch"],"mappings":";;;AASA,MAAMA,IAAIC,mBAAmB,YAAY,OAAO,EAAE;AAE3C,MAAMC,UAAU,IACZ,WAAP,GACI,wDACI,oBAACC,kBAAgBA;QAAC,KAAKH,EAAE;sBACzB,oBAACI,kBAAgBA;QAAC,KAAKJ,EAAE;sBACzB,oBAACI,kBAAgBA;QAAC,KAAKJ,EAAE;sBACzB,oBAACK,eAAaA;QAAC,KAAKL,EAAE;sBACtB,oBAACM,gBAAcA;QAAC,KAAKN,EAAE"}
@@ -0,0 +1,2 @@
1
+ import { type SourceFile } from "ts-morph";
2
+ export declare const hasDefaultExport: (source: SourceFile) => boolean;
@@ -0,0 +1,17 @@
1
+ import { Node, SyntaxKind } from "ts-morph";
2
+ const hasDefaultExport = (source)=>source.getStatements().some((statement)=>{
3
+ if (Node.isExportAssignment(statement)) return !statement.isExportEquals();
4
+ if (Node.isModifierable(statement)) return statement.hasModifier(SyntaxKind.DefaultKeyword);
5
+ if (Node.isExportDeclaration(statement)) return statement.getNamedExports().some((namedExport)=>{
6
+ const exportedAs = namedExport.getAliasNode() ?? namedExport.getNameNode();
7
+ return "default" === getExportedName(exportedAs);
8
+ });
9
+ return false;
10
+ });
11
+ const getExportedName = (node)=>{
12
+ if (Node.isStringLiteral(node)) return node.getLiteralValue();
13
+ return node.getText();
14
+ };
15
+ export { hasDefaultExport };
16
+
17
+ //# sourceMappingURL=hasDefaultExport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extensions/hasDefaultExport.js","sources":["../../src/extensions/hasDefaultExport.ts"],"sourcesContent":["import { Node } from \"ts-morph\";\nimport { SyntaxKind } from \"ts-morph\";\nimport { type SourceFile } from \"ts-morph\";\n\n/*\n * Tells whether a file has a default export by reading its syntax alone.\n *\n * ts-morph's `getDefaultExportSymbol()` gives the same answer, but it asks the type checker, and the\n * checker first loads the TypeScript lib files and every module the file imports. For an admin\n * extension that means React and the admin app's types, so each call took between 0.1s and 2.5s.\n * `webiny watch` makes one call per extension, one after another, which added up to 17s of the\n * startup on a project with 39 extensions.\n *\n * The checker isn't needed here. A default export is always written out in the file itself, as one\n * of the forms below, since `export * from` never re-exports `default`.\n */\nexport const hasDefaultExport = (source: SourceFile): boolean => {\n return source.getStatements().some(statement => {\n // export default something;\n if (Node.isExportAssignment(statement)) {\n return !statement.isExportEquals();\n }\n\n // export default function Extension() {} and export default class Extension {}\n if (Node.isModifierable(statement)) {\n return statement.hasModifier(SyntaxKind.DefaultKeyword);\n }\n\n // export { Extension as default } and export { default } from \"./Extension.js\"\n if (Node.isExportDeclaration(statement)) {\n return statement.getNamedExports().some(namedExport => {\n const exportedAs = namedExport.getAliasNode() ?? namedExport.getNameNode();\n return getExportedName(exportedAs) === \"default\";\n });\n }\n\n return false;\n });\n};\n\n/*\n * An exported name can also be written as a string, as in `export { Extension as \"default\" }`.\n * Its text then includes the quotes, so strings are compared by their value instead.\n */\nconst getExportedName = (node: Node): string => {\n if (Node.isStringLiteral(node)) {\n return node.getLiteralValue();\n }\n\n return node.getText();\n};\n"],"names":["hasDefaultExport","source","statement","Node","SyntaxKind","namedExport","exportedAs","getExportedName","node"],"mappings":";AAgBO,MAAMA,mBAAmB,CAACC,SACtBA,OAAO,aAAa,GAAG,IAAI,CAACC,CAAAA;QAE/B,IAAIC,KAAK,kBAAkB,CAACD,YACxB,OAAO,CAACA,UAAU,cAAc;QAIpC,IAAIC,KAAK,cAAc,CAACD,YACpB,OAAOA,UAAU,WAAW,CAACE,WAAW,cAAc;QAI1D,IAAID,KAAK,mBAAmB,CAACD,YACzB,OAAOA,UAAU,eAAe,GAAG,IAAI,CAACG,CAAAA;YACpC,MAAMC,aAAaD,YAAY,YAAY,MAAMA,YAAY,WAAW;YACxE,OAAOE,AAAgC,cAAhCA,gBAAgBD;QAC3B;QAGJ,OAAO;IACX;AAOJ,MAAMC,kBAAkB,CAACC;IACrB,IAAIL,KAAK,eAAe,CAACK,OACrB,OAAOA,KAAK,eAAe;IAG/B,OAAOA,KAAK,OAAO;AACvB"}