@apimatic/cli 2.0.0-beta.4 → 2.0.0-beta.5

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 (137) hide show
  1. package/README.md +15 -64
  2. package/apimatic.schema.json +2 -2
  3. package/lib/actions/action-result.d.ts +4 -2
  4. package/lib/actions/action-result.js +8 -3
  5. package/lib/actions/action-result.js.map +1 -1
  6. package/lib/actions/api/transform.d.ts +7 -6
  7. package/lib/actions/api/transform.js +12 -13
  8. package/lib/actions/api/transform.js.map +1 -1
  9. package/lib/actions/api/validate.d.ts +4 -5
  10. package/lib/actions/api/validate.js +30 -32
  11. package/lib/actions/api/validate.js.map +1 -1
  12. package/lib/actions/portal/generate.js +3 -3
  13. package/lib/actions/portal/generate.js.map +1 -1
  14. package/lib/actions/quickstart.d.ts +1 -9
  15. package/lib/actions/quickstart.js +122 -102
  16. package/lib/actions/quickstart.js.map +1 -1
  17. package/lib/commands/api/transform.d.ts +1 -1
  18. package/lib/commands/api/transform.js +2 -2
  19. package/lib/commands/api/transform.js.map +1 -1
  20. package/lib/commands/api/validate.d.ts +3 -3
  21. package/lib/commands/api/validate.js +28 -17
  22. package/lib/commands/api/validate.js.map +1 -1
  23. package/lib/commands/plugin/generate.d.ts +1 -1
  24. package/lib/commands/portal/generate.d.ts +2 -2
  25. package/lib/commands/portal/generate.js +1 -1
  26. package/lib/commands/portal/generate.js.map +1 -1
  27. package/lib/commands/portal/serve.d.ts +2 -2
  28. package/lib/commands/portal/serve.js +1 -1
  29. package/lib/commands/sdk/generate.d.ts +1 -1
  30. package/lib/infrastructure/file-service.d.ts +3 -0
  31. package/lib/infrastructure/file-service.js +24 -0
  32. package/lib/infrastructure/file-service.js.map +1 -1
  33. package/lib/infrastructure/portal-dev-server-service.js +2 -1
  34. package/lib/infrastructure/portal-dev-server-service.js.map +1 -1
  35. package/lib/infrastructure/portal-project-service.d.ts +1 -0
  36. package/lib/infrastructure/portal-project-service.js +7 -3
  37. package/lib/infrastructure/portal-project-service.js.map +1 -1
  38. package/lib/infrastructure/services/file-download-service.d.ts +4 -4
  39. package/lib/infrastructure/services/file-download-service.js +14 -14
  40. package/lib/infrastructure/services/file-download-service.js.map +1 -1
  41. package/lib/prompts/api/transform.d.ts +0 -2
  42. package/lib/prompts/api/transform.js +0 -3
  43. package/lib/prompts/api/transform.js.map +1 -1
  44. package/lib/prompts/api/validate.d.ts +2 -2
  45. package/lib/prompts/api/validate.js +35 -3
  46. package/lib/prompts/api/validate.js.map +1 -1
  47. package/lib/prompts/format.d.ts +1 -1
  48. package/lib/prompts/format.js.map +1 -1
  49. package/lib/prompts/portal/generate.d.ts +2 -1
  50. package/lib/prompts/portal/generate.js +22 -6
  51. package/lib/prompts/portal/generate.js.map +1 -1
  52. package/lib/prompts/portal/prepare-project.js +5 -0
  53. package/lib/prompts/portal/prepare-project.js.map +1 -1
  54. package/lib/prompts/portal/serve.js +4 -3
  55. package/lib/prompts/portal/serve.js.map +1 -1
  56. package/lib/prompts/portal/source.d.ts +2 -5
  57. package/lib/prompts/portal/source.js +7 -17
  58. package/lib/prompts/portal/source.js.map +1 -1
  59. package/lib/prompts/quickstart.d.ts +14 -13
  60. package/lib/prompts/quickstart.js +43 -27
  61. package/lib/prompts/quickstart.js.map +1 -1
  62. package/lib/types/apimatic-config/document.d.ts +2 -0
  63. package/lib/types/apimatic-config/document.js +4 -0
  64. package/lib/types/apimatic-config/document.js.map +1 -1
  65. package/lib/types/file/resource-input.d.ts +7 -5
  66. package/lib/types/file/resource-input.js +16 -15
  67. package/lib/types/file/resource-input.js.map +1 -1
  68. package/lib/types/flags-provider.d.ts +6 -1
  69. package/lib/types/flags-provider.js +22 -12
  70. package/lib/types/flags-provider.js.map +1 -1
  71. package/lib/types/plugin-config-context.d.ts +3 -0
  72. package/lib/types/plugin-config-context.js +33 -12
  73. package/lib/types/plugin-config-context.js.map +1 -1
  74. package/lib/types/portal/config/site-address.d.ts +16 -0
  75. package/lib/types/portal/config/site-address.js +67 -0
  76. package/lib/types/portal/config/site-address.js.map +1 -0
  77. package/lib/types/portal/config/site-config.d.ts +3 -5
  78. package/lib/types/portal/config/site-config.js +10 -33
  79. package/lib/types/portal/config/site-config.js.map +1 -1
  80. package/lib/types/portal/config/static-asset.d.ts +2 -2
  81. package/lib/types/portal/config/static-asset.js +2 -2
  82. package/lib/types/portal/config/static-asset.js.map +1 -1
  83. package/lib/types/portal/content-tree.d.ts +11 -4
  84. package/lib/types/portal/content-tree.js +19 -4
  85. package/lib/types/portal/content-tree.js.map +1 -1
  86. package/lib/types/portal/page.js +16 -1
  87. package/lib/types/portal/page.js.map +1 -1
  88. package/lib/types/portal/portal-config.d.ts +6 -3
  89. package/lib/types/portal/portal-config.js +8 -4
  90. package/lib/types/portal/portal-config.js.map +1 -1
  91. package/lib/types/portal/portal-languages.d.ts +2 -0
  92. package/lib/types/portal/portal-languages.js +5 -1
  93. package/lib/types/portal/portal-languages.js.map +1 -1
  94. package/lib/types/portal/portal-source.d.ts +9 -3
  95. package/lib/types/portal-source-context.d.ts +7 -8
  96. package/lib/types/portal-source-context.js +51 -26
  97. package/lib/types/portal-source-context.js.map +1 -1
  98. package/lib/types/project-context.d.ts +18 -0
  99. package/lib/types/project-context.js +18 -1
  100. package/lib/types/project-context.js.map +1 -1
  101. package/lib/types/resource-context.d.ts +25 -10
  102. package/lib/types/resource-context.js +40 -23
  103. package/lib/types/resource-context.js.map +1 -1
  104. package/oclif.manifest.json +88 -70
  105. package/package.json +1 -1
  106. package/portal-template/dependency-directories.ts +31 -40
  107. package/portal-template/downloads.ts +6 -3
  108. package/portal-template/portal-config.ts +2 -0
  109. package/portal-template/prerender-pages.ts +8 -2
  110. package/portal-template/src/components/api-markdown.tsx +32 -0
  111. package/portal-template/src/components/api-page.tsx +8 -1
  112. package/portal-template/src/components/authorization-failure.tsx +63 -0
  113. package/portal-template/src/components/markdown-copy-button.tsx +2 -2
  114. package/portal-template/src/components/plugin-install.tsx +6 -5
  115. package/portal-template/src/components/sdk-actions.tsx +3 -2
  116. package/portal-template/src/components/sdk-cards.tsx +2 -1
  117. package/portal-template/src/components/search.tsx +9 -2
  118. package/portal-template/src/lib/base-path.ts +14 -0
  119. package/portal-template/src/lib/code-titles.ts +8 -0
  120. package/portal-template/src/lib/copy-markdown.ts +4 -2
  121. package/portal-template/src/lib/install-command.ts +5 -5
  122. package/portal-template/src/lib/layout.shared.tsx +5 -3
  123. package/portal-template/src/lib/llms.server.ts +29 -5
  124. package/portal-template/src/lib/oauth-callback.ts +63 -0
  125. package/portal-template/src/lib/portal-types.ts +3 -3
  126. package/portal-template/src/lib/rehype-code-titles.ts +3 -5
  127. package/portal-template/src/lib/remark-image-references.ts +35 -0
  128. package/portal-template/src/lib/search-content.ts +28 -0
  129. package/portal-template/src/lib/search-options.ts +7 -0
  130. package/portal-template/src/lib/source.server.ts +2 -0
  131. package/portal-template/src/router.tsx +3 -1
  132. package/portal-template/src/routes/$.tsx +3 -2
  133. package/portal-template/src/routes/__root.tsx +8 -1
  134. package/portal-template/src/routes/api/search[.]json.ts +23 -2
  135. package/portal-template/src/routes/oauth.callback.tsx +54 -0
  136. package/portal-template/static-functions-base.ts +41 -0
  137. package/portal-template/vite.config.ts +14 -7
@@ -1,7 +1,7 @@
1
1
  import { fileURLToPath } from 'node:url';
2
2
  import react from '@vitejs/plugin-react';
3
3
  import { tanstackStart } from '@tanstack/react-start/plugin/vite';
4
- import { defineConfig } from 'vite';
4
+ import { defineConfig, searchForWorkspaceRoot } from 'vite';
5
5
  import tailwindcss from '@tailwindcss/vite';
6
6
  import { fumadocsMdx } from 'fumadocs-mdx/vite';
7
7
  import { dependencyDirectories } from './dependency-directories.ts';
@@ -10,22 +10,31 @@ import { generatedPagesReload } from './generated-pages-reload.ts';
10
10
  import { readBuildPaths, readPortalIdentity } from './portal-config.ts';
11
11
  import { prerenderPages } from './prerender-pages.ts';
12
12
  import { specReload } from './spec-reload.ts';
13
+ import { remarkImageReferences } from './src/lib/remark-image-references.ts';
14
+ import { staticFunctionsBase } from './static-functions-base.ts';
13
15
 
14
16
  export default defineConfig(async () => {
15
17
  const [paths, identity] = await Promise.all([readBuildPaths(), readPortalIdentity()]);
16
18
  const pages = await prerenderPages(paths, identity.siteUrl);
17
19
  const publicDir: string | false = paths.staticDir ?? false;
18
- const projectDirectory = fileURLToPath(new URL('.', import.meta.url));
20
+ const portalProjectDirectory = fileURLToPath(new URL('.', import.meta.url));
19
21
 
20
22
  return {
23
+ // TanStack Start derives the router's basepath and every asset URL from it.
24
+ base: paths.base,
21
25
  publicDir,
22
26
  plugins: [
23
27
  generatedPagesReload(),
24
28
  downloads(paths.downloadsDir),
29
+ staticFunctionsBase(),
25
30
  // `/images/logo.png` is read from the static directory, and a remote image is never fetched for its size.
26
31
  fumadocsMdx({
27
32
  globalOptions: {
28
- mdxOptions: { remarkImageOptions: { publicDir: publicDir || undefined, external: false } }
33
+ mdxOptions: {
34
+ remarkImageOptions: { publicDir: publicDir || undefined, external: false },
35
+ // A function, so it runs ahead of the preset's own plugins, `remarkImage` among them.
36
+ remarkPlugins: (plugins) => [remarkImageReferences, ...plugins]
37
+ }
29
38
  }
30
39
  }),
31
40
  specReload(paths.specs),
@@ -57,13 +66,11 @@ export default defineConfig(async () => {
57
66
  // listens on `::1` alone, a connect that stalls under load falls back to 127.0.0.1 and is
58
67
  // refused, failing the build; binding IPv4 leaves the fetch a single address to reach.
59
68
  preview: { host: '127.0.0.1' },
60
- // Spelled out because the default, the project alone, misses the CLI installation the
61
- // dependencies are linked from, and the static directory pages import images from.
62
69
  server: {
63
70
  fs: {
64
71
  allow: [
65
- projectDirectory,
66
- ...dependencyDirectories(projectDirectory),
72
+ searchForWorkspaceRoot(portalProjectDirectory),
73
+ ...dependencyDirectories(portalProjectDirectory),
67
74
  ...(paths.staticDir === null ? [] : [paths.staticDir])
68
75
  ]
69
76
  }