@redocly/redoc 0.129.0-next.1 → 0.129.0-next.3
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.
- package/CHANGELOG.md +52 -0
- package/dist/bin.js +1 -1
- package/dist/cli/develop.d.ts +1 -1
- package/dist/cli/develop.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-file-extensions-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-frontmatter-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-markdoc-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-nested-configs-usage.js +1 -1
- package/dist/cli/prepare/analytics/collectors/get-refs-usage.js +1 -1
- package/dist/cli/prepare/index.d.ts +1 -1
- package/dist/cli/translations/collect-config-translations.js +1 -1
- package/dist/cli/translations/update-translations.js +1 -1
- package/dist/client/TestProvider.js +1 -1
- package/dist/client/app/Sidebar/RequestAccessButton.js +2 -2
- package/dist/client/app/Sidebar/Sidebar.js +7 -2
- package/dist/client/app/Sidebar/useSidebarItems.d.ts +1 -0
- package/dist/client/app/Sidebar/useSidebarItems.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntities.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntitiesRelations.js +1 -1
- package/dist/client/app/hooks/catalog/useFetchCatalogEntityRevisions.d.ts +10 -0
- package/dist/client/app/hooks/catalog/useFetchCatalogEntityRevisions.js +1 -0
- package/dist/client/app/hooks/index.d.ts +1 -0
- package/dist/client/app/hooks/index.js +1 -1
- package/dist/client/app/hooks/useBanner.d.ts +4 -0
- package/dist/client/app/hooks/useBanner.js +1 -1
- package/dist/client/app/hooks/useLoginUrl.js +1 -1
- package/dist/client/app/pages/DevLogin/DevLogin.js +1 -1
- package/dist/client/app/pages/Login/Login.js +1 -1
- package/dist/client/app/utils/loadAndNavigate.js +1 -1
- package/dist/client/browser-entry.js +2 -2
- package/dist/client/providers/page-data/hooks.d.ts +2 -1
- package/dist/client/providers/page-data/hooks.js +1 -1
- package/dist/client/providers/theme/ThemeDataProvider.js +1 -1
- package/dist/client/runtime/loader.js +1 -1
- package/dist/client/types/post-message.d.ts +2 -1
- package/dist/client/utils/catalog/inject-catalog-items.d.ts +1 -1
- package/dist/client/utils/catalog/inject-catalog-items.js +1 -1
- package/dist/constants/common.d.ts +0 -4
- package/dist/constants/common.js +1 -1
- package/dist/constants/l10n/langs/ar.js +1 -1
- package/dist/constants/l10n/langs/de.js +1 -1
- package/dist/constants/l10n/langs/en.js +1 -1
- package/dist/constants/l10n/langs/es.js +1 -1
- package/dist/constants/l10n/langs/fr.js +1 -1
- package/dist/constants/l10n/langs/hi.js +1 -1
- package/dist/constants/l10n/langs/it.js +1 -1
- package/dist/constants/l10n/langs/ja.js +1 -1
- package/dist/constants/l10n/langs/ko.js +1 -1
- package/dist/constants/l10n/langs/pl.js +1 -1
- package/dist/constants/l10n/langs/pt-BR.js +1 -1
- package/dist/constants/l10n/langs/pt.js +1 -1
- package/dist/constants/l10n/langs/ru.js +1 -1
- package/dist/constants/l10n/langs/uk.js +1 -1
- package/dist/constants/l10n/langs/zh.js +1 -1
- package/dist/server/api-routes/execute-api-route.d.ts +0 -7
- package/dist/server/api-routes/execute-api-route.js +1 -1
- package/dist/server/api-routes/helpers/setup-logger.d.ts +2 -2
- package/dist/server/api-routes/helpers/setup-logger.js +1 -1
- package/dist/server/api-routes/run-api-routes-worker.js +1 -1
- package/dist/server/fs/cache.d.ts +1 -2
- package/dist/server/fs/cache.js +1 -1
- package/dist/server/fs/content-fs.d.ts +9 -4
- package/dist/server/fs/content-fs.js +1 -1
- package/dist/server/fs/fs.d.ts +6 -6
- package/dist/server/fs/fs.js +1 -3
- package/dist/server/fs/load-error.d.ts +2 -2
- package/dist/server/fs/load-error.js +1 -1
- package/dist/server/fs/utils/async-storage.d.ts +0 -8
- package/dist/server/fs/utils/async-storage.js +1 -1
- package/dist/server/fs/utils/isVirtualFile.d.ts +1 -1
- package/dist/server/fs/utils/isVirtualFile.js +1 -1
- package/dist/server/persistence/kv/helpers/decode-cursor.d.ts +2 -0
- package/dist/server/persistence/kv/helpers/decode-cursor.js +1 -0
- package/dist/server/persistence/kv/helpers/encode-cursor.d.ts +2 -0
- package/dist/server/persistence/kv/helpers/encode-cursor.js +1 -0
- package/dist/server/persistence/kv/mappers/create-kv-list-entry.d.ts +5 -0
- package/dist/server/persistence/kv/mappers/create-kv-list-entry.js +1 -0
- package/dist/server/persistence/kv/mappers/create-kv-value.d.ts +4 -0
- package/dist/server/persistence/kv/mappers/create-kv-value.js +1 -0
- package/dist/server/persistence/kv/repositories/kv-remote-repository.d.ts +5 -5
- package/dist/server/persistence/kv/repositories/kv-remote-repository.js +1 -1
- package/dist/server/persistence/kv/schemas/kv-schemas.d.ts +10 -0
- package/dist/server/persistence/kv/schemas/kv-schemas.js +1 -0
- package/dist/server/persistence/kv/services/kv-service.d.ts +6 -6
- package/dist/server/persistence/kv/services/kv-service.js +1 -1
- package/dist/server/plugins/api-functions/index.js +1 -1
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.d.ts +1 -1
- package/dist/server/plugins/arazzo-docs/arazzo-doc-loader.js +2 -2
- package/dist/server/plugins/arazzo-docs/index.d.ts +1 -1
- package/dist/server/plugins/arazzo-docs/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.d.ts +1 -1
- package/dist/server/plugins/asyncapi-docs/asyncapi-doc-loader.js +2 -2
- package/dist/server/plugins/asyncapi-docs/index.d.ts +1 -1
- package/dist/server/plugins/asyncapi-docs/index.js +1 -1
- package/dist/server/plugins/asyncapi-docs/is-asyncapi-doc.js +1 -1
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.d.ts +23 -18
- package/dist/server/plugins/catalog-entities/database/catalog-entities-service.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-entity.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-related-entity.d.ts +9 -0
- package/dist/server/plugins/catalog-entities/database/mappers/create-bff-related-entity.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.d.ts +1 -0
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-db-record.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-read-model.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation-db-record-from-dto.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation-db-record-from-file-schema.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/create-entity-relation.js +1 -1
- package/dist/server/plugins/catalog-entities/database/mappers/map-entity-relation-row.d.ts +12 -0
- package/dist/server/plugins/catalog-entities/database/mappers/map-entity-relation-row.js +1 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.d.ts +15 -4
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-read-repository.js +67 -55
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.d.ts +21 -15
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.d.ts +16 -3
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-local-write-repository.js +1 -1
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-relations-repository.d.ts +17 -0
- package/dist/server/plugins/catalog-entities/database/repositories/local/catalog-entities-relations-repository.js +1 -0
- package/dist/server/plugins/catalog-entities/database/repositories/utils.d.ts +4 -4
- package/dist/server/plugins/catalog-entities/database/repositories/utils.js +1 -1
- package/dist/server/plugins/catalog-entities/entities/{extract-entities-content.d.ts → extract-file-content.d.ts} +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/arazzo-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/asyncapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/base.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/graphql-entities-extractor.js +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.d.ts +2 -2
- package/dist/server/plugins/catalog-entities/extensions/extractors/api-description/openapi-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/extensions/extractors/fs-entities-extractor.js +1 -1
- package/dist/server/plugins/catalog-entities/get-server-props.d.ts +1 -2
- package/dist/server/plugins/catalog-entities/get-server-props.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/database-schemas.d.ts +64 -0
- package/dist/server/plugins/catalog-entities/schemas/database-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/dto-schemas.d.ts +6 -12
- package/dist/server/plugins/catalog-entities/schemas/dto-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/schemas/read-model-schemas.d.ts +4 -8
- package/dist/server/plugins/catalog-entities/schemas/read-model-schemas.js +1 -1
- package/dist/server/plugins/catalog-entities/utils/catalog-data-collector.js +1 -1
- package/dist/server/plugins/catalog-entities/utils/read-string.d.ts +7 -0
- package/dist/server/plugins/catalog-entities/utils/read-string.js +1 -0
- package/dist/server/plugins/config-parser/loaders/content-slugs-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/nearest-redocly-config-loader.js +1 -1
- package/dist/server/plugins/config-parser/loaders/utils/read-and-validate-config.js +1 -1
- package/dist/server/plugins/config-parser/loaders/yaml-parser.js +1 -1
- package/dist/server/plugins/default-theme/resolve-products-config.js +1 -1
- package/dist/server/plugins/ensure-frontmatter-theme-compatibility.js +1 -1
- package/dist/server/plugins/entitlements/index.js +1 -1
- package/dist/server/plugins/graphql-docs/index.js +1 -1
- package/dist/server/plugins/l10n/index.js +1 -1
- package/dist/server/plugins/lifecycle.js +2 -2
- package/dist/server/plugins/markdown/attribute-resolvers/code-walkthrough/filesets-resolver.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/dereference-json-schema-refs.d.ts +14 -0
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/dereference-json-schema-refs.js +1 -0
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/generate-sample-from-schema.d.ts +62 -0
- package/dist/server/plugins/markdown/attribute-resolvers/helpers/generate-sample-from-schema.js +2 -0
- package/dist/server/plugins/markdown/attribute-resolvers/index.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-code-snippet-from-file.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.d.ts +4 -0
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-example-ref.js +1 -0
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-json-schema-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.d.ts +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-link.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-open-api-ref.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-parsed-yaml.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-raw-content.js +1 -1
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.d.ts +4 -0
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-sample-from-json-schema.js +1 -0
- package/dist/server/plugins/markdown/attribute-resolvers/resolve-svg-content.js +1 -1
- package/dist/server/plugins/markdown/compiler.js +1 -1
- package/dist/server/plugins/markdown/get-server-props.js +1 -1
- package/dist/server/plugins/markdown/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/attributes/index.d.ts +2 -0
- package/dist/server/plugins/markdown/markdoc/attributes/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/attributes/json-example-ref.d.ts +6 -0
- package/dist/server/plugins/markdown/markdoc/attributes/json-example-ref.js +1 -0
- package/dist/server/plugins/markdown/markdoc/attributes/sample-from-json-schema.d.ts +6 -0
- package/dist/server/plugins/markdown/markdoc/attributes/sample-from-json-schema.js +1 -0
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/index.d.ts +1 -0
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/json-example.d.ts +8 -0
- package/dist/server/plugins/markdown/markdoc/custom-components/openapi/json-example.js +7 -0
- package/dist/server/plugins/markdown/markdoc/partials.js +1 -1
- package/dist/server/plugins/markdown/markdoc/resolve-raw-partials.js +1 -1
- package/dist/server/plugins/markdown/markdoc/tags/index.d.ts +4 -0
- package/dist/server/plugins/markdown/markdoc/tags/index.js +1 -1
- package/dist/server/plugins/markdown/markdoc/tags/json-example.d.ts +3 -0
- package/dist/server/plugins/markdown/markdoc/tags/json-example.js +1 -0
- package/dist/server/plugins/markdown/markdown-static-data-loader.js +1 -1
- package/dist/server/plugins/mcp/auth/auth-handlers.d.ts +1 -1
- package/dist/server/plugins/mcp/auth/auth-handlers.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoint-info.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoint-info.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoints.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-endpoints.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-full-api-description.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-full-api-description.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/get-security-schemes.d.ts +7 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/get-security-schemes.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/index.d.ts +4 -3
- package/dist/server/plugins/mcp/docs-mcp/tools/index.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/list-apis.d.ts +5 -2
- package/dist/server/plugins/mcp/docs-mcp/tools/list-apis.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/tools/utils.d.ts +6 -0
- package/dist/server/plugins/mcp/docs-mcp/tools/utils.js +6 -6
- package/dist/server/plugins/mcp/docs-mcp/tools/whoami.js +1 -1
- package/dist/server/plugins/mcp/docs-mcp/utils.d.ts +3 -3
- package/dist/server/plugins/mcp/docs-mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/handlers/docs-mcp-handler.js +1 -1
- package/dist/server/plugins/mcp/index.js +1 -1
- package/dist/server/plugins/mcp/servers/docs-server.d.ts +10 -3
- package/dist/server/plugins/mcp/servers/docs-server.js +1 -1
- package/dist/server/plugins/mcp/types.d.ts +26 -2
- package/dist/server/plugins/mcp/utils.d.ts +9 -8
- package/dist/server/plugins/mcp/utils.js +1 -1
- package/dist/server/plugins/mcp/workers/run-api-routes-worker.js +1 -1
- package/dist/server/plugins/nav-utils.js +1 -1
- package/dist/server/plugins/openapi-docs/decorators.d.ts +3 -2
- package/dist/server/plugins/openapi-docs/decorators.js +1 -1
- package/dist/server/plugins/openapi-docs/index.d.ts +2 -2
- package/dist/server/plugins/openapi-docs/index.js +1 -1
- package/dist/server/plugins/openapi-docs/is-openapi-doc.js +1 -1
- package/dist/server/plugins/openapi-docs/load-definition.d.ts +1 -1
- package/dist/server/plugins/openapi-docs/load-definition.js +3 -3
- package/dist/server/plugins/pages/index.js +1 -1
- package/dist/server/plugins/scorecard-classic/get-scorecard-config.d.ts +11 -0
- package/dist/server/plugins/scorecard-classic/loaders/scorecard.js +1 -1
- package/dist/server/plugins/search/llmstxt/index.js +5 -5
- package/dist/server/plugins/sidebars/index.js +3 -3
- package/dist/server/plugins/utils.js +1 -1
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-relations-table.d.ts +25 -46
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-relations-table.js +1 -1
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.d.ts +20 -3
- package/dist/server/providers/database/databases/catalog-sqlite/schemas/entities-table.js +1 -1
- package/dist/server/providers/database/pagination/combined-filters.d.ts +4 -1
- package/dist/server/providers/database/pagination/combined-filters.js +1 -1
- package/dist/server/providers/database/pagination/filter.d.ts +1 -0
- package/dist/server/providers/database/pagination/filter.js +1 -1
- package/dist/server/providers/database/pagination/index.d.ts +4 -1
- package/dist/server/providers/database/pagination/utils/decode-cursor.js +1 -1
- package/dist/server/ssr/index.js +1 -1
- package/dist/server/ssr/render.js +1 -1
- package/dist/server/ssr/template.d.ts +1 -1
- package/dist/server/ssr/template.js +13 -13
- package/dist/server/ssr/utils.js +27 -13
- package/dist/server/store.js +1 -1
- package/dist/server/tools/notifiers/formatter.d.ts +2 -0
- package/dist/server/tools/notifiers/formatter.js +3 -3
- package/dist/server/tools/notifiers/logger.d.ts +18 -39
- package/dist/server/tools/notifiers/logger.js +2 -6
- package/dist/server/tools/notifiers/reporter.js +9 -9
- package/dist/server/tools/notifiers/terminal-manager.d.ts +8 -0
- package/dist/server/tools/notifiers/terminal-manager.js +5 -0
- package/dist/server/types/fs.d.ts +5 -10
- package/dist/server/types/plugins/api-routes.d.ts +0 -3
- package/dist/server/types/plugins/common.d.ts +0 -1
- package/dist/server/utils/is-valid-iso-date.d.ts +5 -0
- package/dist/server/utils/is-valid-iso-date.js +1 -0
- package/dist/server/utils/lifecycle-hooks.js +1 -1
- package/dist/server/utils/queue.js +1 -1
- package/dist/server/utils/redirects/find-redirect.d.ts +4 -2
- package/dist/server/utils/redirects/find-redirect.js +1 -1
- package/dist/server/utils/resolve-asset-path.js +1 -1
- package/dist/server/utils/safe-parse.d.ts +6 -0
- package/dist/server/utils/safe-parse.js +1 -0
- package/dist/server/utils/validate-and-sanitize-string.d.ts +29 -0
- package/dist/server/utils/validate-and-sanitize-string.js +1 -0
- package/dist/server/web-server/auth.d.ts +5 -0
- package/dist/server/web-server/auth.js +3 -3
- package/dist/server/web-server/http.js +2 -2
- package/dist/server/web-server/middleware/loggerMiddleware.js +1 -1
- package/dist/server/web-server/routes/auth.js +1 -1
- package/dist/server/web-server/routes/catalog/bff-catalog-related-entities.js +1 -1
- package/dist/server/web-server/routes/catalog/bff-catalog.js +1 -1
- package/dist/server/web-server/routes/catalog/catalog-relations.js +1 -1
- package/dist/server/web-server/routes/mcp-oauth.js +1 -1
- package/dist/server/web-server/routes/search.js +1 -1
- package/dist/server/web-server/utils/get-redirect-login-url.js +1 -1
- package/dist/types/ssr.d.ts +3 -1
- package/dist/utils/auth/build-login-url.d.ts +1 -3
- package/dist/utils/auth/build-login-url.js +1 -1
- package/dist/utils/env/is-local-development.d.ts +13 -0
- package/dist/utils/env/is-local-development.js +1 -0
- package/dist/utils/env/is-production.d.ts +13 -0
- package/dist/utils/env/is-production.js +1 -0
- package/dist/utils/env/is-web-view.d.ts +14 -0
- package/dist/utils/env/is-web-view.js +1 -0
- package/dist/utils/path/remove-fragment.d.ts +16 -0
- package/dist/utils/path/remove-fragment.js +1 -0
- package/package.json +12 -11
- package/dist/server/persistence/kv/mappers/create-kv-read-record.d.ts +0 -4
- package/dist/server/persistence/kv/mappers/create-kv-read-record.js +0 -1
- package/dist/server/web-server/routes/otel/types.d.ts +0 -61
- package/dist/server/web-server/routes/otel/types.js +0 -1
- /package/dist/server/plugins/catalog-entities/entities/{extract-entities-content.js → extract-file-content.js} +0 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { SQLiteSelect } from 'drizzle-orm/sqlite-core';
|
|
2
|
+
import type { SQL } from 'drizzle-orm';
|
|
2
3
|
import type { PaginationParams } from './schemas.js';
|
|
3
|
-
export declare const applyPagination: <T extends SQLiteSelect>(sqlBuilderInstance: T, paginationParams: PaginationParams
|
|
4
|
+
export declare const applyPagination: <T extends SQLiteSelect>(sqlBuilderInstance: T, paginationParams: PaginationParams & {
|
|
5
|
+
baseWhereCondition?: SQL;
|
|
6
|
+
}, tableAlias?: string) => T;
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isBase64 as
|
|
1
|
+
import{isBase64 as r}from"./is-base-64.js";function n(e){if(!e)return e;if(r(e))try{return Buffer.from(e,"base64url").toString()}catch{return e}return e}export{n as decodeCursor};
|
package/dist/server/ssr/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withPathPrefix as O}from"@redocly/theme/core/utils";import{SSR_RENDER_MODE as y}from"../constants/common.js";import{logger as b}from"../tools/notifiers/logger.js";import{canAccessResource as L,filterDataByAccessDeep as d,isResourcePubliclyAccessible as _}from"../utils/rbac.js";import{readSharedData as x}from"../utils/index.js";import{render as C}from"./render.js";import{getServerProps as T}from"./server-side-props/get-server-props.js";import{ssrWorkers as $}from"../workers/ssr-worker-pool.js";import{SSR_WORKER_KEY as j}from"../workers/ssr-worker-pool.js";async function J(e,s,a,r,o,i=!1){const w=b.startTiming(),E=r.routesSharedData.get(e.slug)||{},S=s.sharedDataIds||{},m={...E,...S},{isAuthenticated:g,teams:u,claims:{name:q,picture:I,email:f}}=a?.get("auth")||{claims:{}},t={isAuthenticated:g,email:f,teams:u},R=Object.fromEntries(await Promise.all(Object.entries(m).map(async([H,D])=>[D,await x(D,r.outdir)]))),P=d(R,t,r.config.rbac,r.config.requiresLogin),v=d(r.globalData,t,r.config.rbac,r.config.requiresLogin),p=L(e,t,r.config.rbac,r.config.requiresLogin),A=!!r.compilationErrors?.length?{templateId:"compilation-error",props:{compilationErrors:r.compilationErrors},sharedDataIds:{}}:null,h={page:{templateId:e.templateId,isPublic:_(e,r.config),slug:O(e.slug),versions:d(e.versions,t,r.config.rbac,r.config.requiresLogin),props:s,sharedDataIds:p?m:{},request:{search:a?.req.raw.context.url?.search||"",url:a?.req.raw.context.url?.href||""},userInfo:{isAuthenticated:g,name:q,picture:I,email:f,teams:u},...A},store:{globalData:v,config:r.config,ssr:r.ssr,hasSitemap:r.hasSitemap},sharedData:p?P:{},serverOutDir:r.serverOutDir,outdir:r.outdir,ssrHref:k(a),userAgent:a?.req.raw.headers.get("user-agent")||"",telemetry:o,omitSuspense:i};let n,c,l;return y==="worker"?{html:n,statusCode:c,error:l}=await $.exec(j,[h]):{html:n,statusCode:c,error:l}=await C(h),b.verboseTime(w,`Page rendered ${e.slug}`),{html:n,props:s,statusCode:c,error:l}}function k(e){const s=e?.req.raw.url;if(!s)return"";const a=new URL(s),r=e?.req.raw.headers,o=r?.get("x-forwarded-proto")||a.protocol.replace(":",""),i=r?.get("x-forwarded-host")||a.host;return`${o}://${i}`}export{T as getServerProps,J as renderPage};
|
|
1
|
+
import{withPathPrefix as O}from"@redocly/theme/core/utils";import{SSR_RENDER_MODE as y}from"../constants/common.js";import{logger as b}from"../tools/notifiers/logger.js";import{canAccessResource as L,filterDataByAccessDeep as d,isResourcePubliclyAccessible as _}from"../utils/rbac.js";import{readSharedData as x}from"../utils/index.js";import{render as C}from"./render.js";import{getServerProps as T}from"./server-side-props/get-server-props.js";import{ssrWorkers as $}from"../workers/ssr-worker-pool.js";import{SSR_WORKER_KEY as j}from"../workers/ssr-worker-pool.js";async function J(e,s,a,r,o,i=!1){const w=b.startTiming(),E=r.routesSharedData.get(e.slug)||{},S=s.sharedDataIds||{},m={...E,...S},{isAuthenticated:g,teams:u,claims:{name:q,picture:I,email:f}}=a?.get("auth")||{claims:{}},t={isAuthenticated:g,email:f,teams:u},R=Object.fromEntries(await Promise.all(Object.entries(m).map(async([H,D])=>[D,await x(D,r.outdir)]))),P=d(R,t,r.config.rbac,r.config.requiresLogin),v=d(r.globalData,t,r.config.rbac,r.config.requiresLogin),p=L(e,t,r.config.rbac,r.config.requiresLogin),A=!!r.compilationErrors?.length?{templateId:"compilation-error",props:{compilationErrors:r.compilationErrors},sharedDataIds:{}}:null,h={page:{templateId:e.templateId,isPublic:_(e,r.config),slug:O(e.slug),versions:d(e.versions,t,r.config.rbac,r.config.requiresLogin),props:s,sharedDataIds:p?m:{},product:e.product,request:{search:a?.req.raw.context.url?.search||"",url:a?.req.raw.context.url?.href||""},userInfo:{isAuthenticated:g,name:q,picture:I,email:f,teams:u},...A},store:{globalData:v,config:r.config,ssr:r.ssr,hasSitemap:r.hasSitemap},sharedData:p?P:{},serverOutDir:r.serverOutDir,outdir:r.outdir,ssrHref:k(a),userAgent:a?.req.raw.headers.get("user-agent")||"",telemetry:o,omitSuspense:i};let n,c,l;return y==="worker"?{html:n,statusCode:c,error:l}=await $.exec(j,[h]):{html:n,statusCode:c,error:l}=await C(h),b.verboseTime(w,`Page rendered ${e.slug}`),{html:n,props:s,statusCode:c,error:l}}function k(e){const s=e?.req.raw.url;if(!s)return"";const a=new URL(s),r=e?.req.raw.headers,o=r?.get("x-forwarded-proto")||a.protocol.replace(":",""),i=r?.get("x-forwarded-host")||a.host;return`${o}://${i}`}export{T as getServerProps,J as renderPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{pathToFileURL as F}from"url";import{HelmetProvider as
|
|
1
|
+
import{pathToFileURL as F}from"url";import{HelmetProvider as q}from"@dr.pogodin/react-helmet";import{renderToString as l}from"react-dom/server";import{StaticRouterProvider as Y,createStaticHandler as z,createStaticRouter as G}from"react-router-dom/server.js";import r from"react";import{readFile as J}from"fs/promises";import{join as K}from"path";import{withPathPrefix as m,getLocaleFromPathname as Q,withoutPathPrefix as V,removeTrailingSlash as W}from"@redocly/theme/core/utils";import{RUNTIME_RESOURCES_DIR as T}from"../constants/common.js";import{slash as X}from"../../utils/path/slash.js";import{reporter as Z}from"../tools/notifiers/reporter.js";import{isDevelopMode as tt}from"../utils/envs/is-develop-mode.js";import{slug as et}from"../utils/slugger.js";import{htmlTemplate as rt}from"./template.js";import{detectColorSchemaScript as ot,generatePreloadPageData as st}from"./utils.js";import"./hijack-console.js";import{getSitemapLinkTag as nt}from"./get-sitemap-link-tag.js";let p="";async function at(t){return process.env.REDOCLY_STATIC_BUNDLE?await import("../../client/server-entry.js"):await import(F(`${X(t)}/server-entry.js`)+"?"+new Date)}async function vt(t){if(!process.env.REDOCLY_STATIC_BUNDLE){const e=Z.getCompilationProblems();if(e.length>0){const{renderCompilationError:n}=await import("./render-compilation-error.js");return n(e)}}const{Loader:g,App:d,routes:E,ServerStyleSheet:R,StyleSheetManager:C,ErrorDetails:w,initL10n:D}=await at(t.serverOutDir),{page:u,store:{globalData:S,hasSitemap:y},sharedData:P,ssrHref:v}=t,h=S?.l10n,i=Q(V(u.slug),h?.defaultLocale,h?.locales),f=t.page.request?.url||"http://localhost/";await g.prepare({...u,slug:W(new URL(f).pathname)},P,S,i),await D(i);const c=new R,{query:L,dataRoutes:_}=z([{Component:d,path:m("*"),children:E}]),s=await L(new Request(f));if(s instanceof Response)throw s;const B=G(_,s);try{globalThis.SSR_HOSTNAME=v,globalThis.SSR_USER_AGENT=t.userAgent,globalThis.SSR_OMIT_SUSPENSE=t.omitSuspense;const e={},n=l(r.createElement(q,{context:e},r.createElement(C,{sheet:c.instance},r.createElement(Y,{router:B,context:s})))),b=y?nt():"",a=e.helmet,x=a?.title.toString()||"",U=t.store.globalData?.logo?.favicon,o=t.store.config,k=`<link rel="preload" as="fetch" crossorigin="anonymous" href="${m("/app-data.json")}" />`,A=st(t.page.slug),M=ot(o),j=t.page.product?.name?`product-${et(t.page.product.name)}`:"",H=t.store.ssr.headTags.join(""),N=t.store.ssr.postBodyTags.join(""),O=t.store.ssr.preBodyTags.join(""),I=`<link rel="stylesheet" href="${m(T)}/browser-entry.css" />`;!tt()&&!p&&(p=`<style>${await J(K(t.outdir,T,"browser-entry.css"),"utf-8")}</style>`);const $={bodyHtml:n,linkTags:o.linkTags+c.getStyleTags()+(a?.link.toString()||""),title:x,favicon:U,headScriptTags:b+M+o.headScriptTags+H+(a?.script.toString()||"")+(a?.meta.toString()||""),preload:[k,A],postBodyScriptTags:o.postBodyScriptTags+N,preBodyScriptTags:o.preBodyScriptTags||""+O,lang:i,productClass:j,runtimeCss:p||I};return{html:rt($),statusCode:200}}catch(e){return t.telemetry.sendSsrErrorCaughtMessage({message:e.message}),{html:l(r.createElement(w,{error:e})),statusCode:500,error:e}}finally{c.seal(),g.clear()}}function Lt(t){return l(r.createElement(r.Fragment,null,...t))}export{vt as render,Lt as renderComponents};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RenderTemplateInput } from '../../types/index.js';
|
|
2
|
-
export declare function htmlTemplate({ bodyHtml, linkTags, title, favicon, preload, headScriptTags, postBodyScriptTags, preBodyScriptTags, lang, fonts, runtimeCss, }: RenderTemplateInput & {
|
|
2
|
+
export declare function htmlTemplate({ bodyHtml, linkTags, title, favicon, preload, headScriptTags, postBodyScriptTags, preBodyScriptTags, lang, productClass, fonts, runtimeCss, }: RenderTemplateInput & {
|
|
3
3
|
fonts?: string;
|
|
4
4
|
}): string;
|
|
5
5
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{withPathPrefix as
|
|
2
|
-
<html${
|
|
1
|
+
import{withPathPrefix as p}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as y}from"../../constants/common.js";import{RUNTIME_RESOURCES_DIR as E}from"../constants/common.js";import{INIT_BROWSER_HOOKS_SCRIPT as R}from"./init-browser-hooks-script.js";const _="";function w({bodyHtml:r,linkTags:i,title:m,favicon:e,preload:n,headScriptTags:$,postBodyScriptTags:s,preBodyScriptTags:l,lang:t,productClass:o,fonts:a=_,runtimeCss:h}){const c=t&&t!=y?` lang="${t}"`:"",d=o?` class="${o}"`:"";return`<!doctype html>
|
|
2
|
+
<html${c}${d}>
|
|
3
3
|
<head>
|
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
|
-
${
|
|
6
|
+
${m||""}
|
|
7
7
|
${e&&`<link rel="icon" href="${e}" />`||""}
|
|
8
|
-
${
|
|
9
|
-
${
|
|
8
|
+
${R}
|
|
9
|
+
${n?.join(`
|
|
10
10
|
`)||""}
|
|
11
11
|
<style>
|
|
12
12
|
body { margin: 0 }
|
|
13
13
|
</style>
|
|
14
|
-
${
|
|
15
|
-
${
|
|
16
|
-
${
|
|
14
|
+
${a||""}
|
|
15
|
+
${i||""}
|
|
16
|
+
${$||""}
|
|
17
17
|
${h||""}
|
|
18
18
|
</head>
|
|
19
19
|
<body>
|
|
20
|
-
${
|
|
21
|
-
<div id="app_root">${
|
|
22
|
-
<script async type="module" src="${
|
|
23
|
-
${
|
|
20
|
+
${l||""}
|
|
21
|
+
<div id="app_root">${r}</div>
|
|
22
|
+
<script async type="module" src="${p(E)}/browser-entry.js"></script>
|
|
23
|
+
${s||""}
|
|
24
24
|
</body>
|
|
25
|
-
</html>`}export{
|
|
25
|
+
</html>`}export{w as htmlTemplate};
|
package/dist/server/ssr/utils.js
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
|
-
import{pathToFileURL as
|
|
1
|
+
import{pathToFileURL as d}from"url";import{removeTrailingSlash as u}from"../../utils/url/remove-trailing-slash.js";import{slash as p}from"../../utils/path/slash.js";import{getClientPageDataUrl as f}from"../../utils/url/get-client-page-data-url.js";import{DEFAULT_COLOR_MODES as l}from"@redocly/theme/core/constants";function E(t){const o=t?.colorMode,{modes:e=[l.LIGHT,l.DARK],hide:r,ignoreDetection:n}=o||{},s=e&&`'${e[0]}'`,a=e?.[0],m=e?.some(i=>i===a)?`'${a}'`:void 0;return r||!s?"":`
|
|
2
2
|
<script>
|
|
3
3
|
if(window&&document.documentElement)
|
|
4
4
|
{
|
|
5
5
|
const q=new URLSearchParams(window.location.search).get("colorSchema");
|
|
6
6
|
const e=q || window.localStorage.getItem("colorSchema");
|
|
7
7
|
if(e) {
|
|
8
|
-
const modeToSet = [${
|
|
9
|
-
${
|
|
8
|
+
const modeToSet = [${e.map(i=>`'${i}'`)}].some((mode) => mode === e) ? e : 'light';
|
|
9
|
+
${c("modeToSet",e)}
|
|
10
10
|
} else {
|
|
11
11
|
if (window.matchMedia) {
|
|
12
|
-
${h(
|
|
12
|
+
${h(n,m,s,e)}
|
|
13
13
|
} else {
|
|
14
|
-
${
|
|
14
|
+
${c(s,e)}
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
</script>`}function h(o,e,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
</script>`}function h(t,o,e,r=["light","dark"]){return t?o?c(o,r):e?c(e,r):"return":g(o,r)}function c(t=`'${l.LIGHT}'`,o=["light","dark"]){return`(function() {
|
|
19
|
+
var root = document.documentElement;
|
|
20
|
+
var modes = [${o.map(r=>`'${r}'`).join(", ")}];
|
|
21
|
+
var value = ${t};
|
|
22
|
+
modes.forEach(function(className) {
|
|
23
|
+
root.classList.remove(className);
|
|
24
|
+
});
|
|
25
|
+
root.classList.add(value);
|
|
26
|
+
})();`}function g(t,o=["light","dark"]){const e=o.map(n=>`'${n}'`).join(", "),r=t?`root.classList.add(${t});`:"";return`(function() {
|
|
27
|
+
var root = document.documentElement;
|
|
28
|
+
var modes = [${e}];
|
|
29
|
+
modes.forEach(function(className) {
|
|
30
|
+
root.classList.remove(className);
|
|
31
|
+
});
|
|
32
|
+
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
33
|
+
root.classList.add('dark');
|
|
34
|
+
} else if (window.matchMedia('(prefers-color-scheme: light)').matches) {
|
|
35
|
+
root.classList.add('light');
|
|
36
|
+
}${r?` else {
|
|
37
|
+
${r}
|
|
38
|
+
}`:""}
|
|
39
|
+
})();`}async function P(t){try{return process.env.REDOCLY_STATIC_BUNDLE?await import("@portal/server-props"):await import(d(`${p(t)}/server-props-entry.js`)+"?"+new Date)}catch{return{}}}function C(t){const o=t.split("/").map(encodeURIComponent).join("/"),e=o==="/"?o:u(o);return`<link rel="preload" as="fetch" crossorigin="anonymous" href="${f(e)}" />`}const M=(t,o)=>{if(!o)return{params:[],queries:{}};const e=t.slug||"",n=o.req.path.split(e.endsWith("/")?e:`${e}/`)[1]||"",s=o.req.query(),a=n.replace("data.json","");return!a||a==="/"?{params:[],queries:s}:{params:a.split("/").filter(Boolean),queries:s}};export{E as detectColorSchemaScript,C as generatePreloadPageData,M as getPathParams,P as importServerProps};
|
package/dist/server/store.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import A from"@markdoc/markdoc";import{getPathnameForLocale as C}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as f}from"../constants/common.js";import{DEFAULT_TITLE as P}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as T}from"../utils/guards/is-object.js";import{mapObject as O}from"../utils/object/map-object.js";import{getValueDeep as w}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as M}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as l}from"../utils/path/normalize-route-slug.js";import{isLocalLink as k}from"../utils/path/is-local-link.js";import{reporter as S}from"./tools/notifiers/reporter.js";import{logger as p}from"./tools/notifiers/logger.js";import{sha1 as L}from"./utils/crypto/sha1.js";import{writeEnvVariable as _}from"./utils/envs/write-env-variable.js";import{readEnvVariable as F}from"./utils/envs/read-env-variable.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as G}from"./ssr/render.js";import{readStaticData as I,writeStaticData as N}from"./utils/static-data.js";import{parseAndResolveMarkdoc as V}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as j}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{isL10nPath as H}from"./fs/utils/is-l10n-path.js";import{resolveMetadataGlobs as J}from"./utils/globs.js";import{replaceEnvVariablesDeep as U}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{addWildcardRedirectToTree as K}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as q}from"../cli/telemetry/helpers/trace-step.js";const R={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map"},g="markdown/partials",Ee="markdown/partials-deps",v="PLAN_GATES",$=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORG_ID"],be="userDefinedApiFunctions";class E{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#e={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},rbac:{},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#t=new Map;constructor({outdir:e,contentDir:t,serverMode:s=!1,serverOutDir:r}){this.#r=t,this.outdir=e,this.serverMode=s,this.serverOutDir=r,this.userCodeReady=new Promise(a=>{this.#a=a})}on(e,t){const s=this.listeners.get(e);s?s.add(t):this.listeners.set(e,new Set([t]))}queueEvent=(e,t,...s)=>{this.#t.set(e+String(t),[e,t,...s])};runListeners=(e,t,...s)=>{for(const r of this.listeners.get(e)||new Set)t?r(t,...s):r(...s)};startPluginsRun(){this.clear(),this.#o=new Promise(e=>{this.#i=e})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const e of this.#t.values())this.runListeners(...e);this.#t.clear()}startEsbuildRun(){this.#n=new Promise(e=>{this.#c=e})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await q("build.reload_markdoc_options",async()=>{const e=y.instance(),t=await j(this.serverOutDir),s=Object.fromEntries(Object.entries(t.tags).filter(([r])=>D[r]!=null?e.canAccessFeature(D[r]):!0));this.#s={...t,tags:s}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(g),themeConfig:this.config.markdown}}setGlobalData=e=>{const t=this.globalData,s={...this.globalData,...e};this.globalData=s,JSON.stringify(s)!==JSON.stringify(t)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;parseMarkdoc=async(e,t,s)=>{const{data:{info:r,ast:a},compoundHash:i}=await V(e,this.markdocOptions,{actions:this,context:t});for(const o of r.sharedDataDeps||[]){for(const n of s?.routeSlugs||[])this.addRouteSharedData(n,o,o);for(const n of s?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(o),this.sharedDataDeps.set(n,c)}}for(const o of r.dynamicMarkdocComponents||[]){for(const n of s?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(o),this.routesDynamicComponents.set(n,c)}for(const n of s?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(o),this.sharedDataMarkdocComponents.set(n,c)}}return{info:r,ast:a,compoundHash:i}};async loadOpenApiDefinitions(e){return(await e.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(e){return(await e.cache.load(".","asyncapi-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setGlobalConfig=e=>{const t=Object.keys(e);for(const i of t)for(const o in this.replacedEnvVars)if(o===i||o.startsWith(`${i}:`)){const n=o.split(":"),{error:c,value:d}=w(e,n);(c||d!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:s,unsetEnvVars:r,replacedValues:a}=U(e);for(const i of r)this.unsetEnvVars.add(i);Object.assign(this.replacedEnvVars,a),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,t)=>{if(!y.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const a=l(e).toLowerCase();this.config.redirects[a]=t,a.endsWith("*")&&K(this.config.wildcardRedirectsTree,a)};getRedirect=e=>{const t=l(e).toLowerCase();return x(t,this.config.redirects,this.config.wildcardRedirectsTree)};createSharedData=async(e,t,s)=>{if(s&&this.#e[e]===s)return e;const r=JSON.stringify(t),a=s??L(r);return this.#e[e]===a||(this.#e[e]=a,await B(e,r,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,t,s)=>{const r=M(e),a=this.routesSharedData.get(r)||{};a[t]=s,this.routesSharedData.set(r,a),p.verbose(`Adding shared data to ${e}, ${t}, ${s}`)};getRouteSharedDataByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.routesSharedData.get(t)||{}:{}};addRoute=e=>{const s={...J(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:s}),p.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,t,s)=>{const r=[f,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const i=C(e,f,a.code,r);this.addRouteSharedData(i,t,s)}};addApiRoute=e=>{this.apiRoutes.push(e),p.verbose("Created API route %s",e.slug)};addMiddleware=e=>{this.middleware.push(e),p.verbose("Created middleware %s",e.id)};getRouteByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.getRouteBySlug(t):void 0};getRouteBySlug=(e,t={})=>{const{followRedirect:s=!0}=t,r=this.getRedirect(e);return s&&r?this.routesBySlug.get(l(r.to)):this.routesBySlug.get(e)};slugHasRouteOrRedirect=e=>{const t=l(e);if(this.routesBySlug.has(t))return!0;const s=this.getRedirect(e);if(!s)return!1;if(!k(s.to))return!0;const r=l(s.to);return this.routesBySlug.has(r)};getRoutesByTemplateId=e=>this.newRoutes.filter(t=>t.templateId===e);getAllRoutesForLocale=(e=f)=>{const t=Array.from(this.routesBySlug.values()),s=e.toLowerCase();return t.filter(r=>e===f?!H(r.fsPath):r.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,t)=>(this.templates.set(e,t),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,t)=>(this.apiRoutesRequestHandlers.set(e,t),e);registerServerPropsGetter=(e,t)=>(this.serverPropsGetters.set(e,t),e);registerPagePropsGetter=(e,t)=>{this.pagePropsGetters.set(e,t)};async writeRouteStaticData(e,t){const s=await this.resolveRouteStaticData(e,t,!1);s&&N(e.slug,s,this.outdir)}async resolveRouteStaticData(e,t,s){if(this.serverMode)return I(e.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:(d,h)=>this.parseMarkdoc(d,h,{routeSlugs:[e.slug]})},a=await e.getStaticData?.(e,r)||{},i=new Set(this.routesDynamicComponents.get(e.slug)),o=this.routesSharedData.get(e.slug)||{};for(const d of Object.values(o)){const h=this.sharedDataMarkdocComponents.get(d);h&&h.forEach(u=>i.add(u));const m=this.sharedDataDeps.get(d);m&&m.forEach(u=>this.addRouteSharedData(e.slug,u,u))}const n=this.getGlobalConfig("seo"),c=a?.frontmatter||{};return{...a,frontmatter:{...c,seo:{...c?.seo,title:c?.seo?.title||await e.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(i),metadata:{...a?.props?.metadata,...e.metadata},seo:{title:P,...n,...a.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,t){if(!e?.length)return;const s=typeof e[0]=="string"?e.join(""):G(e);s&&(t==="head"?this.ssr.headTags.push(s):t==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[s,r]of Object.entries(R))switch(r){case"map":const a=Array.from(this[s].entries());e.push([s,a]);break;case"object":s==="config"&&e.push([s,await this.getConfigWithEnvPlaceholders()]),e.push([s,this[s]]);break;default:throw new Error("Invalid format")}const t=Object.fromEntries(e);return t[v]=F("PLAN_GATES"),t}static fromJson(e,t){const s=new E(t);for(const[a,i]of Object.entries(R))switch(i){case"map":s[a]=new Map(e[a]);break;case"object":if(a==="config"){s.setGlobalConfig(e[a]);break}s[a]=e[a];break;default:throw new Error("Invalid format")}s.config[g]=z(s.config[g]||{});const r=e[v];return r&&_("PLAN_GATES",r),s}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const t in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[t],r=t.split(":"),a=r.pop(),{error:i,value:o}=w(e,r);if(i||!T(o)&&!Array.isArray(o)){await S.panicOnBuild(`Failed to replace env var with env name for ${t}`);continue}o[a]=s}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(s=>!$.includes(s));if(e.length===0)return;const t=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await S.panicOnBuildContentError(t)}}function z(b){return O(b,e=>A.Ast.fromJSON(JSON.stringify(e)))}export{g as MARKDOC_PARTIALS_DATA_KEY,Ee as MARKDOC_PARTIALS_DEPS_KEY,E as Store,be as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
|
|
1
|
+
import A from"@markdoc/markdoc";import{getPathnameForLocale as C}from"@redocly/theme/core/utils";import{DEFAULT_LOCALE_PLACEHOLDER as u}from"../constants/common.js";import{DEFAULT_TITLE as P}from"./constants/common.js";import{GATED_MARKDOC_TAGS as D}from"./constants/entitlements.js";import{isObject as T}from"../utils/guards/is-object.js";import{mapObject as O}from"../utils/object/map-object.js";import{getValueDeep as w}from"../utils/object/get-value-deep.js";import{removeTrailingSlash as M}from"../utils/url/remove-trailing-slash.js";import{normalizeRouteSlug as f}from"../utils/path/normalize-route-slug.js";import{isLocalLink as k}from"../utils/path/is-local-link.js";import{reporter as S}from"./tools/notifiers/reporter.js";import{logger as p}from"./tools/notifiers/logger.js";import{sha1 as L}from"./utils/crypto/sha1.js";import{writeEnvVariable as _}from"./utils/envs/write-env-variable.js";import{readEnvVariable as F}from"./utils/envs/read-env-variable.js";import{writeSharedData as B}from"./utils/index.js";import{renderComponents as G}from"./ssr/render.js";import{readStaticData as I,writeStaticData as N}from"./utils/static-data.js";import{parseAndResolveMarkdoc as V}from"./plugins/markdown/compiler.js";import{getMarkdocOptions as j}from"./plugins/markdown/markdoc/markdoc-options.js";import{EntitlementsProvider as y}from"./entitlements/entitlements-provider.js";import{isL10nPath as H}from"./fs/utils/is-l10n-path.js";import{resolveMetadataGlobs as J}from"./utils/globs.js";import{replaceEnvVariablesDeep as U}from"./utils/envs/replace-env-variables-deep.js";import{findRedirect as x}from"./utils/redirects/find-redirect.js";import{addWildcardRedirectToTree as K}from"./utils/redirects/add-wildcard-redirect-to-tree.js";import{telemetryTraceStep as q}from"../cli/telemetry/helpers/trace-step.js";const R={routesBySlug:"map",apiRoutes:"object",middleware:"object",routesByFsPath:"map",routesSharedData:"map",globalData:"object",config:"object",ssr:"object",searchFacets:"map"},g="markdown/partials",Ee="markdown/partials-deps",v="PLAN_GATES",$=["OAUTH_CLIENT_ID","OAUTH_CLIENT_SECRET","ORG_ID"],be="userDefinedApiFunctions";class E{routesBySlug=new Map;replacedEnvVars={};unsetEnvVars=new Set;lifecycleContext;newRoutes=[];#e={};routesByFsPath=new Map;apiRoutes=[];middleware=[];routesSharedData=new Map;sharedDataDeps=new Map;sharedDataMarkdocComponents=new Map;routesDynamicComponents=new Map;ssr={preBodyTags:[],postBodyTags:[],headTags:[]};searchFacets=new Map;searchEngine;templates=new Map;browserPlugins=new Set;apiRoutesRequestHandlers=new Map;serverPropsGetters=new Map;pagePropsGetters=new Map;listeners=new Map;globalData={};#s=void 0;config={configFilePath:"",redirects:{},wildcardRedirectsTree:{},rbac:{},directoryPermissions:{},devLogin:!1,ssoDirect:{}};#r;serverMode;serverOutDir;outdir;buildRevision=0;hasSitemap=!1;compilationErrors=[];#a;userCodeReady;#o=Promise.resolve();#i;#n=Promise.resolve();#c;#t=new Map;constructor({outdir:e,contentDir:t,serverMode:s=!1,serverOutDir:r}){this.#r=t,this.outdir=e,this.serverMode=s,this.serverOutDir=r,this.userCodeReady=new Promise(a=>{this.#a=a})}on(e,t){const s=this.listeners.get(e);s?s.add(t):this.listeners.set(e,new Set([t]))}queueEvent=(e,t,...s)=>{this.#t.set(e+String(t),[e,t,...s])};runListeners=(e,t,...s)=>{for(const r of this.listeners.get(e)||new Set)t?r(t,...s):r(...s)};startPluginsRun(){this.clear(),this.#o=new Promise(e=>{this.#i=e})}waitForPluginsLifecycle(){return Promise.all([this.#o,this.#n])}finishPluginsRun(){this.#i?.();for(const e of this.#t.values())this.runListeners(...e);this.#t.clear()}startEsbuildRun(){this.#n=new Promise(e=>{this.#c=e})}finishEsbuildRun(){this.#c?.()}get contentDir(){if(this.serverMode)throw new Error("contentDir should not be used in server mode");return this.#r}markUserCodeReady(){this.#a?.(!0)}async reloadMarkdocOptions(){await q("build.reload_markdoc_options",async()=>{const e=y.instance(),t=await j(this.serverOutDir),s=Object.fromEntries(Object.entries(t.tags).filter(([r])=>D[r]!=null?e.canAccessFeature(D[r]):!0));this.#s={...t,tags:s}})}get markdocOptions(){return{...this.#s,partials:this.getGlobalConfig(g),themeConfig:this.config.markdown}}setGlobalData=e=>{const t=this.globalData,s={...this.globalData,...e};this.globalData=s,JSON.stringify(s)!==JSON.stringify(t)&&this.queueEvent("global-data-updated",void 0,s)};getGlobalData=()=>this.globalData;parseMarkdoc=async(e,t,s)=>{const{data:{info:r,ast:a},compoundHash:i}=await V(e,this.markdocOptions,{actions:this,context:t});for(const o of r.sharedDataDeps||[]){for(const n of s?.routeSlugs||[])this.addRouteSharedData(n,o,o);for(const n of s?.sharedDataIds||[]){const c=this.sharedDataDeps.get(n)||new Set;c.add(o),this.sharedDataDeps.set(n,c)}}for(const o of r.dynamicMarkdocComponents||[]){for(const n of s?.routeSlugs||[]){const c=this.routesDynamicComponents.get(n)||new Set;c.add(o),this.routesDynamicComponents.set(n,c)}for(const n of s?.sharedDataIds||[]){const c=this.sharedDataMarkdocComponents.get(n)||new Set;c.add(o),this.sharedDataMarkdocComponents.set(n,c)}}return{info:r,ast:a,compoundHash:i}};async loadOpenApiDefinitions(e){return(await e.cache.load(".","load-oas-docs")).data}async loadAsyncApiDefinitions(e){return(await e.cache.load(".","asyncapi-docs")).data}setSearchEngine(e){this.searchEngine=e}setSearchFacets=e=>{this.searchFacets=e};setGlobalConfig=e=>{const t=Object.keys(e);for(const i of t)for(const o in this.replacedEnvVars)if(o===i||o.startsWith(`${i}:`)){const n=o.split(":"),{error:c,value:d}=w(e,n);(c||d!==this.replacedEnvVars[o].replaced)&&delete this.replacedEnvVars[o]}const{resolvedObj:s,unsetEnvVars:r,replacedValues:a}=U(e);for(const i of r)this.unsetEnvVars.add(i);Object.assign(this.replacedEnvVars,a),Object.assign(this.config,s)};getConfig=()=>this.config;getGlobalConfig=e=>this.config[e];getSearchFacets=()=>this.searchFacets;addRedirect=(e,t)=>{if(!y.instance().canAccessFeature("redirects")&&e!=="/")return;this.config.redirects||(this.config.redirects={});const a=f(e).toLowerCase();this.config.redirects[a]=t,a.endsWith("*")&&K(this.config.wildcardRedirectsTree,a)};getRedirect=e=>{const t=f(e).toLowerCase();return x(t,this.config.redirects,this.config.wildcardRedirectsTree)};createSharedData=async(e,t,s)=>{if(s&&this.#e[e]===s)return e;const r=JSON.stringify(t),a=s??L(r);return this.#e[e]===a||(this.#e[e]=a,await B(e,r,this.outdir),this.queueEvent("shared-data-updated",e)),e};addRouteSharedData=(e,t,s)=>{const r=M(e),a=this.routesSharedData.get(r)||{};a[t]=s,this.routesSharedData.set(r,a),p.verbose(`Adding shared data to ${e}, ${t}, ${s}`)};getRouteSharedDataByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.routesSharedData.get(t)||{}:{}};addRoute=e=>{const s={...J(e.fsPath,this.config.metadataGlobs),...e.metadata||{}};this.newRoutes.push({...e,metadata:s}),p.verbose("Created route %s",e.slug)};addRouteSharedDataToAllLocales=(e,t,s)=>{const r=[u,...this.lifecycleContext?.fs.localeFolders||[]].map(a=>({code:a,name:a}));for(const a of r){const i=C(e,u,a.code,r);this.addRouteSharedData(i,t,s)}};addApiRoute=e=>{this.apiRoutes.push(e),p.verbose("Created API route %s",e.slug)};addMiddleware=e=>{this.middleware.push(e),p.verbose("Created middleware %s",e.id)};getRouteByFsPath=e=>{const t=this.routesByFsPath.get(e);return t?this.getRouteBySlug(t):void 0};getRouteBySlug=(e,t={})=>{const{followRedirect:s=!0}=t,r=this.getRedirect(e);return s&&r?this.routesBySlug.get(f(r.to)):this.routesBySlug.get(e)};slugHasRouteOrRedirect=e=>{if(this.routesBySlug.has(e))return!0;const t=this.getRedirect(e);if(!t)return!1;if(!k(t.to))return!0;const s=f(t.to);return this.routesBySlug.has(s)};getRoutesByTemplateId=e=>this.newRoutes.filter(t=>t.templateId===e);getAllRoutesForLocale=(e=u)=>{const t=Array.from(this.routesBySlug.values()),s=e.toLowerCase();return t.filter(r=>e===u?!H(r.fsPath):r.slug.startsWith(`/${s}`))};getAllRoutes=()=>Array.from(this.routesBySlug.values());getAllApiRoutes=()=>this.apiRoutes;getAllMiddleware=()=>this.middleware;getTemplate=e=>this.templates.get(e);getRequestHandler=e=>this.apiRoutesRequestHandlers.get(e);createTemplate=(e,t)=>(this.templates.set(e,t),e);addBrowserPlugin=e=>{this.browserPlugins.add(e)};createRequestHandler=(e,t)=>(this.apiRoutesRequestHandlers.set(e,t),e);registerServerPropsGetter=(e,t)=>(this.serverPropsGetters.set(e,t),e);registerPagePropsGetter=(e,t)=>{this.pagePropsGetters.set(e,t)};async writeRouteStaticData(e,t){const s=await this.resolveRouteStaticData(e,t,!1);s&&N(e.slug,s,this.outdir)}async resolveRouteStaticData(e,t,s){if(this.serverMode)return I(e.slug,this.outdir);const r={...this,contentDir:this.contentDir,parseMarkdoc:(d,l)=>this.parseMarkdoc(d,l,{routeSlugs:[e.slug]})},a=await e.getStaticData?.(e,r)||{},i=new Set(this.routesDynamicComponents.get(e.slug)),o=this.routesSharedData.get(e.slug)||{};for(const d of Object.values(o)){const l=this.sharedDataMarkdocComponents.get(d);l&&l.forEach(h=>i.add(h));const m=this.sharedDataDeps.get(d);m&&m.forEach(h=>this.addRouteSharedData(e.slug,h,h))}const n=this.getGlobalConfig("seo"),c=a?.frontmatter||{};return{...a,frontmatter:{...c,seo:{...c?.seo,title:c?.seo?.title||await e.getNavText?.()}},props:{...a.props,dynamicMarkdocComponents:Array.from(i),metadata:{...a?.props?.metadata,...e.metadata},seo:{title:P,...n,...a.props?.seo},compilationErrors:this.compilationErrors},lastModified:s||!e.fsPath?null:await this.lifecycleContext?.fs.getLastModified(e.fsPath)}}addSsrComponents(e,t){if(!e?.length)return;const s=typeof e[0]=="string"?e.join(""):G(e);s&&(t==="head"?this.ssr.headTags.push(s):t==="preBody"?this.ssr.preBodyTags.push(s):this.ssr.postBodyTags.push(s))}clear=()=>{this.routesByFsPath.clear(),this.templates.clear(),this.newRoutes=[],this.routesBySlug.clear(),this.apiRoutes=[],this.middleware=[],this.routesSharedData.clear(),this.sharedDataDeps.clear(),this.sharedDataMarkdocComponents.clear(),this.routesDynamicComponents.clear(),this.config.redirects={},this.config.wildcardRedirectsTree={},this.config.directoryPermissions={},this.ssr={preBodyTags:[],postBodyTags:[],headTags:[]}};async toJson(){const e=[];for(const[s,r]of Object.entries(R))switch(r){case"map":const a=Array.from(this[s].entries());e.push([s,a]);break;case"object":s==="config"&&e.push([s,await this.getConfigWithEnvPlaceholders()]),e.push([s,this[s]]);break;default:throw new Error("Invalid format")}const t=Object.fromEntries(e);return t[v]=F("PLAN_GATES"),t}static fromJson(e,t){const s=new E(t);for(const[a,i]of Object.entries(R))switch(i){case"map":s[a]=new Map(e[a]);break;case"object":if(a==="config"){s.setGlobalConfig(e[a]);break}s[a]=e[a];break;default:throw new Error("Invalid format")}s.config[g]=W(s.config[g]||{});const r=e[v];return r&&_("PLAN_GATES",r),s}async getConfigWithEnvPlaceholders(){const e=JSON.parse(JSON.stringify(this.config));for(const t in this.replacedEnvVars){const{original:s}=this.replacedEnvVars[t],r=t.split(":"),a=r.pop(),{error:i,value:o}=w(e,r);if(i||!T(o)&&!Array.isArray(o)){await S.panicOnBuild(`Failed to replace env var with env name for ${t}`);continue}o[a]=s}return e}async reportUnsetEnvVars(){if(this.unsetEnvVars.size===0)return;const e=Array.from(this.unsetEnvVars).filter(s=>!$.includes(s));if(e.length===0)return;const t=`Failed to resolve config. The following environment variables are not set: ${e.join(", ")}`;await S.panicOnBuildContentError(t)}}function W(b){return O(b,e=>A.Ast.fromJSON(JSON.stringify(e)))}export{g as MARKDOC_PARTIALS_DATA_KEY,Ee as MARKDOC_PARTIALS_DEPS_KEY,E as Store,be as USER_DEFINED_API_FUNCTIONS_COUNTER_KEY};
|
|
@@ -15,6 +15,8 @@ export declare enum LogLevel {
|
|
|
15
15
|
VERBOSE = "VERBOSE",
|
|
16
16
|
HTTP = "HTTP"
|
|
17
17
|
}
|
|
18
|
+
export declare function shouldLog(level: LogLevel, minLevel: LogLevel): boolean;
|
|
19
|
+
export declare function parseLogLevel(levelStr: string | undefined): LogLevel | undefined;
|
|
18
20
|
declare const formatter: {
|
|
19
21
|
format(log: LogData): string;
|
|
20
22
|
interpolate(pattern: string, ...args: any[]): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import*as O from"node:path";import{isProductionMode as
|
|
2
|
-
`},
|
|
3
|
-
`},y=e=>(e%500<100
|
|
1
|
+
import*as O from"node:path";import{isProductionMode as g}from"../../utils/envs/is-production-mode.js";import{maskEmail as T}from"./helpers/privacy/mask-email.js";import{maskSubject as E}from"./helpers/privacy/mask-subject.js";import{removePii as A}from"./helpers/privacy/remove-pii.js";import{removePiiFromUrl as P}from"./helpers/privacy/remove-pii-from-url.js";import{red as $,green as x,bold as j,blue as p,gray as i,yellow as C,cyan as w}from"./helpers/colors.js";var n;(function(e){e.INFO="INFO",e.WARN="WARN",e.ERROR="ERROR",e.SUCCESS="SUCCESS",e.VERBOSE="VERBOSE",e.HTTP="HTTP"})(n||(n={}));const b={[n.VERBOSE]:0,[n.HTTP]:1,[n.INFO]:2,[n.SUCCESS]:2,[n.WARN]:3,[n.ERROR]:4};function W(e,s){return b[e]>=b[s]}function L(e){if(!e)return;const s=e.toUpperCase();if(s in n)return s}const F={[n.INFO]:p,[n.SUCCESS]:x,[n.WARN]:C,[n.ERROR]:$,[n.HTTP]:w,[n.VERBOSE]:i},I={"%ap":e=>p(O.resolve(e)),"%rp":e=>p(O.relative(process.cwd(),e)),"%s":e=>e?.toString(),"%c":e=>p(e)},v={format(e){switch(process.env.PORTAL_LOG_FORMAT){case"JSON":return U(e);default:return H(e)}},interpolate(e,...s){const a=Object.keys(I).map(t=>`(${t})`).join("|"),m=new RegExp(a,"g");let r,u=e;for(;(r=m.exec(e))!==null;){r.index===m.lastIndex&&m.lastIndex++;const t=s.shift();if(t===void 0)break;const o=r[0];u=u.replace(o,I[o](t))}return u}};var z=v;const H=e=>{const{level:s,message:a,duration:m,context:r}=e,u=g(),t=[F[s](j(`[${s.toLowerCase()}]`))];if(u&&t.push(i(`time="${N()}"`)),r){const{email:o,ipAddress:c,subject:l,method:d,pathname:f,statusCode:S,teams:h,apiFunction:R}=r;R&&t.push(p(`fn="${R}"`)),S&&t.push(y(S)),e.level===n.HTTP&&(d&&t.push(i(`method="${d}"`)),f&&t.push(i(`path="${P(f)}"`))),c&&t.push(i(`ip="${c}"`)),o&&t.push(i(`email="${T(o)}"`)),l&&t.push(i(`sub="${E(l)}"`)),h?.length&&t.push(i(`teams="${h.join(", ")}"`))}if(a){const o=u?`msg="${String(A(a)).replaceAll?.('"','\\"')}"`:String(a);t.push(o)}return e.level===n.HTTP&&r?.userAgent&&t.push(i(`agent="${r.userAgent}"`)),m&&t.push(M(m)),t.join(" ")+`
|
|
2
|
+
`},U=({context:e,message:s,...a})=>{const{method:m,pathname:r,statusCode:u,userAgent:t,subject:o,email:c,teams:l,apiFunction:d}=e||{},f={...a,email:c&&T(c),subject:o&&E(o),teams:l,apiFunction:d,...a.level===n.HTTP?{method:m,pathname:String(P(r)),statusCode:u,userAgent:t}:{message:String(A(s))}};return g()&&(f.time=N()),JSON.stringify(f,["time","level","scope","message","duration","method","pathname","statusCode","userAgent","subject","ipAddress","email","apiFunction"])+`
|
|
3
|
+
`},y=e=>(e%500<100?$:e%400<100?C:x)(`status="${e}"`),N=()=>{let e=new Date().getTimezoneOffset()*6e4;return new Date(Date.now()-e).toISOString().slice(0,-1)},M=e=>i(`dur="${Math.round(e)}ms"`);export{n as LogLevel,z as default,L as parseLogLevel,W as shouldLog};
|
|
@@ -12,34 +12,32 @@ export type LoggerContext = {
|
|
|
12
12
|
apiFunction?: string;
|
|
13
13
|
requestHandlerId?: string;
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}[];
|
|
20
|
-
prevStickyLines: number;
|
|
15
|
+
type LoggerOptions = {
|
|
16
|
+
context?: LoggerContext;
|
|
17
|
+
forceNonInteractive?: boolean;
|
|
18
|
+
minLogLevel?: LogLevel;
|
|
21
19
|
};
|
|
22
20
|
export declare class Logger {
|
|
23
21
|
#private;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
info(message: string, ...args:
|
|
27
|
-
infoTime(timingId: symbol | string, message: string, ...args:
|
|
22
|
+
constructor({ context, forceNonInteractive, minLogLevel }?: LoggerOptions);
|
|
23
|
+
shouldLog(level: LogLevel): boolean;
|
|
24
|
+
info(message: string, ...args: unknown[]): void;
|
|
25
|
+
infoTime(timingId: symbol | string, message: string, ...args: unknown[]): {
|
|
28
26
|
message: string;
|
|
29
27
|
timeMs: number;
|
|
30
28
|
} | undefined;
|
|
31
|
-
success(message: string, ...args:
|
|
32
|
-
|
|
33
|
-
successTime(timingId: symbol | string, message: string, ...args:
|
|
29
|
+
success(message: string, ...args: unknown[]): void;
|
|
30
|
+
logInFooter(id: string, message: string, ...args: unknown[]): void;
|
|
31
|
+
successTime(timingId: symbol | string, message: string, ...args: unknown[]): {
|
|
34
32
|
message: string;
|
|
35
33
|
timeMs: number;
|
|
36
34
|
} | undefined;
|
|
37
|
-
warn(message: string, ...args:
|
|
38
|
-
warnProd(message: string, ...args:
|
|
39
|
-
error(message: string, ...args:
|
|
40
|
-
contentError(message: string, ...args:
|
|
41
|
-
verbose(message: string, ...args:
|
|
42
|
-
verboseTime(timingId: symbol | string, message: string, ...args:
|
|
35
|
+
warn(message: string, ...args: unknown[]): void;
|
|
36
|
+
warnProd(message: string, ...args: unknown[]): void;
|
|
37
|
+
error(message: string, ...args: unknown[]): void;
|
|
38
|
+
contentError(message: string, ...args: unknown[]): void;
|
|
39
|
+
verbose(message: string, ...args: unknown[]): void;
|
|
40
|
+
verboseTime(timingId: symbol | string, message: string, ...args: unknown[]): {
|
|
43
41
|
message: string;
|
|
44
42
|
timeMs: number;
|
|
45
43
|
} | undefined;
|
|
@@ -50,28 +48,9 @@ export declare class Logger {
|
|
|
50
48
|
startTiming(label?: string): symbol | string;
|
|
51
49
|
updateContext(context: Partial<LoggerContext>): void;
|
|
52
50
|
clearAllTimeouts(): void;
|
|
53
|
-
setStickyState({ globalStickyLines, prevStickyLines, }: {
|
|
54
|
-
globalStickyLines: {
|
|
55
|
-
id: string;
|
|
56
|
-
content: string;
|
|
57
|
-
}[];
|
|
58
|
-
prevStickyLines: number;
|
|
59
|
-
}): void;
|
|
60
|
-
getStickyState(): {
|
|
61
|
-
globalStickyLines: {
|
|
62
|
-
id: string;
|
|
63
|
-
content: string;
|
|
64
|
-
}[];
|
|
65
|
-
prevStickyLines: number;
|
|
66
|
-
};
|
|
67
|
-
printSticky(): void;
|
|
68
|
-
clearSticky(): void;
|
|
69
51
|
isInteractive(): boolean;
|
|
70
|
-
warnForRealFile(message: string, relativePath: string, fs: ContentFs, ...args:
|
|
71
|
-
patchConsole(): void;
|
|
72
|
-
static getLogLevel(method: (typeof monkeyPatchedMethods)[number]): LogLevel;
|
|
52
|
+
warnForRealFile(message: string, relativePath: string, fs: ContentFs, ...args: unknown[]): void;
|
|
73
53
|
}
|
|
74
54
|
export declare const logger: Logger;
|
|
75
|
-
declare const monkeyPatchedMethods: readonly ["log", "warn", "error", "info", "debug", "trace", "dir", "table", "assert"];
|
|
76
55
|
export {};
|
|
77
56
|
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
`},{id:"sep3",content:`
|
|
4
|
-
`}];class h{#t=[];#s=0;#i;#c;#r=new Map;#o=new Map;disableSticky=!1;constructor(t){this.#i=t,this.#c=u()}info(t,...e){this.#e({level:i.INFO,message:t,args:e})}infoTime(t,e,...s){return this.#n(i.INFO,e,t,...s)}success(t,...e){this.#e({level:i.SUCCESS,message:t,args:e})}logSticky(t,e,...s){const o=this.#t.find(r=>r.id===t),n=l.interpolate(e,...s)+`
|
|
5
|
-
`;if(!this.isInteractive()){this.#e({level:i.INFO,message:e,args:s});return}o?o.content=n:(this.#t.length===0&&this.#t.push(...g),this.#t.push({id:t,content:n}));for(let r=0;r<this.#s;r++)c.moveCursor(process.stderr,0,-1),c.clearLine(process.stderr,1);this.printSticky(),this.#s=this.#t.length}successTime(t,e,...s){return this.#n(i.SUCCESS,e,t,...s)}warn(t,...e){this.#e({level:i.WARN,message:t,args:e})}warnProd(t,...e){this.#c?this.warn(t,...e):this.verbose(t,...e)}error(t,...e){this.#e({level:i.ERROR,message:t,args:e})}contentError(t,...e){this.#e({level:i.ERROR,message:t,scope:"content",args:e})}verbose(t,...e){process.env.REPORTER_VERBOSE==="true"&&this.#e({level:i.VERBOSE,message:t,args:e})}verboseTime(t,e,...s){if(process.env.REPORTER_VERBOSE==="true")return this.#n(i.VERBOSE,e,t,...s)}httpTime(t){return this.#n(i.HTTP,"",t)}startTiming(t){const e=t||Symbol();this.#r.set(e,performance.now());const s=setTimeout(()=>{this.#r.delete(e),this.#o.delete(e)},500*1e3);return this.#o.set(e,s),e}updateContext(t){this.#i={...this.#i,...t}}clearAllTimeouts(){for(const t of this.#o.values())clearTimeout(t);this.#o.clear()}#n(t,e,s,...o){const n=this.#r.get(s);if(!n)return;const r=Math.round(performance.now()-n);return this.#r.delete(s),this.#e({level:t,message:e,duration:r,args:o}),{message:e,timeMs:r}}setStickyState({globalStickyLines:t,prevStickyLines:e}){this.#t=t,this.#s=e}getStickyState(){return{globalStickyLines:this.#t,prevStickyLines:this.#s}}printSticky(){this.#t.forEach(t=>{process.stderr.write(t.content)})}clearSticky(){if(this.isInteractive())for(let t=0;t<this.#s;t++)c.moveCursor(process.stderr,0,-1),c.clearLine(process.stderr,1)}#e({level:t,message:e,duration:s,scope:o,args:n}){!this.disableSticky&&this.isInteractive()&&this.clearSticky();let r=e&&l.interpolate(e,...n);r&&s!=null&&t!==i.VERBOSE&&m.sendTimingPerformedMessage({timeMs:s,message:r});const a={level:t,message:r,duration:s,scope:o,context:this.#i};process.stderr.write(l.format(a)),!this.disableSticky&&this.isInteractive()&&this.printSticky()}isInteractive(){return!!(process.stderr&&process.stderr.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env)&&f())}async warnForRealFile(t,e,s,...o){await v(e,s)||this.warn(t,e,...o)}patchConsole(){for(const t of y)console[t]=(...e)=>{!this.disableSticky&&this.isInteractive()&&this.clearSticky();const s=[],o=new d({write(a,E,p){s.push(a.toString()),p()}});new console.Console({stdout:o,stderr:o})[t](...e);let r="";t==="table"||t==="dir"?r=`
|
|
6
|
-
${s.join("").slice(0,-1)}`:r=s.join("").slice(0,-1),process.stderr.write(l.format({level:h.getLogLevel(t),context:this.#i,message:r})),!this.disableSticky&&this.isInteractive()&&this.printSticky()}}static getLogLevel(t){switch(t){case"error":return i.ERROR;case"warn":return i.WARN;case"debug":case"trace":return i.VERBOSE;case"info":case"log":case"dir":case"table":case"assert":return i.INFO;default:const e=t;throw new Error(`Unhandled method: ${e}`)}}}const M=new h,y=["log","warn","error","info","debug","trace","dir","table","assert"];export{h as Logger,M as logger};
|
|
1
|
+
import{telemetry as a}from"../../telemetry/index.js";import{isProductionMode as c}from"../../utils/envs/is-production-mode.js";import l,{LogLevel as r,shouldLog as h,parseLogLevel as u}from"./formatter.js";import{isVirtualFile as f}from"../../fs/utils/isVirtualFile.js";import{TerminalManager as p}from"./terminal-manager.js";import{isDevelopMode as g}from"../../utils/envs/is-develop-mode.js";class d{#e;#l;#i;#n;#r=new Map;#o=new Map;constructor({context:t,forceNonInteractive:e,minLogLevel:i}={}){this.#e=t,this.#l=c(),this.#i=new p(e),this.#n=i??u(process.env.REDOCLY_LOG_LEVEL)??(g()?r.INFO:r.HTTP)}shouldLog(t){return h(t,this.#n)}info(t,...e){this.#t({level:r.INFO,message:t,args:e})}infoTime(t,e,...i){return this.#s(r.INFO,e,t,...i)}success(t,...e){this.#t({level:r.SUCCESS,message:t,args:e})}logInFooter(t,e,...i){const o=l.interpolate(e,...i)+`
|
|
2
|
+
`;this.isInteractive()||this.#i.isFooterChanged(t,o)&&this.#t({level:r.INFO,message:e,args:i}),this.#i.updateFooter(t,o)}successTime(t,e,...i){return this.#s(r.SUCCESS,e,t,...i)}warn(t,...e){this.#t({level:r.WARN,message:t,args:e})}warnProd(t,...e){this.#l?this.warn(t,...e):this.verbose(t,...e)}error(t,...e){this.#t({level:r.ERROR,message:t,args:e})}contentError(t,...e){this.#t({level:r.ERROR,message:t,scope:"content",args:e})}verbose(t,...e){this.#t({level:r.VERBOSE,message:t,args:e})}verboseTime(t,e,...i){return this.#s(r.VERBOSE,e,t,...i)}httpTime(t){return this.#s(r.HTTP,"",t)}startTiming(t){const e=t||Symbol();this.#r.set(e,performance.now());const i=setTimeout(()=>{this.#r.delete(e),this.#o.delete(e)},500*1e3);return this.#o.set(e,i),e}updateContext(t){this.#e={...this.#e,...t}}clearAllTimeouts(){for(const t of this.#o.values())clearTimeout(t);this.#o.clear()}isInteractive(){return this.#i.isInteractive()}warnForRealFile(t,e,i,...o){f(e,i)||this.warn(t,e,...o)}#s(t,e,i,...o){const n=this.#r.get(i);if(!n)return;const s=Math.round(performance.now()-n);return this.#r.delete(i),this.#t({level:t,message:e,duration:s,args:o}),{message:e,timeMs:s}}#t({level:t,message:e,duration:i,scope:o,args:n}){if(!h(t,this.#n))return;let s=e&&l.interpolate(e,...n);s&&i!=null&&t!==r.VERBOSE&&a.sendTimingPerformedMessage({timeMs:i,message:s});const m={level:t,message:s,duration:i,scope:o,context:this.#e};process.stderr.write(l.format(m))}}const O=new d;export{d as Logger,O as logger};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{isBuildMode as h}from"../../utils/envs/is-build-mode.js";import{logger as
|
|
2
|
-
`+r.stack),h()?await this.panic(r,...t):this.pushError(r,"PANIC",...t)}async panicOnBuildContentErrorForRealFile(r,t,
|
|
3
|
-
`+r.stack),h()?await this.panicOnContentError(r,...t):this.pushError(r,"PANIC",...t)}async panic(r,...t){let
|
|
4
|
-
`+r.stack):
|
|
5
|
-
`+r.stack):
|
|
6
|
-
`)
|
|
1
|
+
import{isBuildMode as h}from"../../utils/envs/is-build-mode.js";import{logger as e}from"../../tools/notifiers/logger.js";import P from"./formatter.js";import{blue as g,gray as p,red as a}from"./helpers/colors.js";import{isVirtualFile as b}from"../../fs/utils/isVirtualFile.js";import{telemetry as u}from"../../telemetry/index.js";import{shutdowner as f}from"../shutdowner.js";const c=30;class C{#r=[];#o=[];#e=new Map;#t=[];pushError(r,t,...o){const n=P.interpolate(r,...o);this.#r.push({severity:t,message:n,type:"ERROR"})}reportBrokenLink(r){this.#r.push(r)}reportCompilationError(r){const t=`${r.message}::${r.sourceFileRelativePath}::${r?.sourceFileLocation?.line}`;this.#e.has(t)||this.#e.set(t,r)}reportPageRenderError(r){this.#t.push(r)}async panicOnBuild(r,...t){r instanceof Error&&(r=r.message+`
|
|
2
|
+
`+r.stack),h()?await this.panic(r,...t):this.pushError(r,"PANIC",...t)}async panicOnBuildContentErrorForRealFile(r,t,o,...n){b(t,o)||await this.panicOnBuildContentError(r,...n)}async panicOnBuildContentError(r,...t){r instanceof Error&&(r=r.message+`
|
|
3
|
+
`+r.stack),h()?await this.panicOnContentError(r,...t):this.pushError(r,"PANIC",...t)}async panic(r,...t){let o;r instanceof Error?(o=r,r=r.message+`
|
|
4
|
+
`+r.stack):o=new Error(r),e.error(r,...t),u.sendCliErrorCaughtMessage({message:r}),await f.exitWithCode(1,o)}async panicOnContentError(r,...t){let o;r instanceof Error?(o=r,r=r.message+`
|
|
5
|
+
`+r.stack):o=new Error(r),e.contentError(r,...t),u.sendCliErrorCaughtMessage({message:r,scope:"content"}),await f.exitWithCode(1,o)}reportMarkdocProblem(r){this.#o.push(r)}clearErrors(){this.#r=[]}clearMarkdocProblems(){this.#o=[]}clearEsbuildProblems(){this.#e.clear()}clearPageRenderProblems(){this.#t=[]}getCompilationProblem(r){return this.#e.get(r)}getCompilationProblems(){return[...this.#e.values()]}getPageRenderProblems(){return this.#t}getPageRenderProblem(r){return this.#t.find(t=>t.sourceFileRelativePath===r)}getProblems(){return[...this.#r,...this.getCompilationProblems(),...this.#o,...this.#t]}summary(r,t=0){const o=this.getProblems(),n=this.#o.filter(l=>l.type==="BROKEN_LINK").length,s=this.#r.filter(l=>l.type==="BROKEN_LINK").length,m=this.#o.length-n,E=this.#r.length-s+this.getCompilationProblems().length+this.#t.length;return e.logInFooter("validate",o.length?a(" \u274C Status: %s markdoc errors, %s broken links, %s other errors"):" \u2705 Status: No errors found",m,n+s,E),t!==0&&e.logInFooter("pages",` \u{1F4C4} Total pages: ${t}`),e.logInFooter("timing",r),e.logInFooter("validate-sep",""),e.isInteractive()&&(o.length?e.logInFooter("actions","Press (e) to print all errors, (q) to quit"):e.logInFooter("actions",p("Press (q) to quit"))),o}printErrors(r=[]){const t=this.#r.length,o=r.length?r:this.getProblems();let n=0;for(const s of o.slice(0,c))n>=t?e.contentError(a(`[${++n}] `)+d(s)):e.error(a(`[${++n}] `)+d(s));o.length>c&&e.error(`... and ${o.length-c} more errors`)}listenStdin(){if(!e.isInteractive())return;process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.setEncoding("utf8");const r=this.printErrors.bind(this);process.stdin.on("data",function(t){if(t===""&&process.exit(),t==="\x7F"){process.stdout.write("\b \b");return}if(t==="\r"){process.stdout.write(`
|
|
6
|
+
`);return}if(t==="e"){r();return}t==="q"&&process.exit(0)})}}const B=new C;function d(i){const r=i.sourceFileLocation,t=r?`:${r.line}:${r.character??1}`:"";return i.message+(i.codeframe?`
|
|
7
7
|
|
|
8
|
-
`+
|
|
8
|
+
`+i.codeframe+`
|
|
9
9
|
|
|
10
10
|
`:`
|
|
11
|
-
`)+(
|
|
12
|
-
`:"")}export{
|
|
11
|
+
`)+(i.sourceFileRelativePath?p(`at ${g("./"+i.sourceFileRelativePath)}${t}`)+`
|
|
12
|
+
`:"")}export{C as Reporter,B as reporter};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare class TerminalManager {
|
|
2
|
+
#private;
|
|
3
|
+
constructor(forceNonInteractive?: boolean);
|
|
4
|
+
isInteractive(): boolean;
|
|
5
|
+
isFooterChanged(id: string, content: string): boolean;
|
|
6
|
+
updateFooter(id: string, content: string): void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=terminal-manager.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{isDevelopMode as h}from"../../utils/envs/is-develop-mode.js";import{gray as p}from"./helpers/colors.js";const t="\x1B[",i=`${t}s`,o=`${t}u`,d=`${t}J`,a=c=>`${t}1;${c}r`,f=`${t}r`,w=`${t}?25h`,R=`${t}?25l`,l=()=>`${p("\u2500".repeat(process.stderr.columns||80))}
|
|
2
|
+
|
|
3
|
+
`,u=3;class I{#s=new Map;#r=process.stderr.rows;#e=0;#t=!1;#i=!1;constructor(s=!1){this.#i=s}isInteractive(){return!!(!this.#i&&process.stderr&&process.stderr.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env)&&h())}isFooterChanged(s,r){return this.#s.get(s)!==r}updateFooter(s,r){const e=!this.#s.has(s);this.#s.set(s,r),this.isInteractive()&&(e?this.#n():this.#c())}get#o(){if(this.#s.size===0)return 0;let s=u;for(const r of this.#s.values())s+=(r.match(/\n/g)||[]).length;return s}#c(){if(!this.isInteractive()||this.#s.size===0)return;this.#h();const s=this.#o,r=process.stderr.rows;if(!(s>r)){process.stderr.write(i),process.stderr.cursorTo(0,r-s+1),process.stderr.write(l());for(const e of this.#s.values())process.stderr.write(e);process.stderr.write(o)}}#n(s=0){if(!this.isInteractive())return;const r=process.stderr.rows;let e=this.#o;e>r&&(e=0);const n=e-this.#e;this.#e=e,n>0&&(process.stderr.write(i),process.stderr.write(`
|
|
4
|
+
`.repeat(n)),process.stderr.write(o)),process.stderr.write(i),process.stderr.write(d),s<0&&process.stderr.write(`
|
|
5
|
+
`.repeat(e)),process.stderr.write(a(r-e)),process.stderr.write(o),this.#c()}#h(){this.#t||(this.#t=!0,process.stderr.write(R),process.on("exit",this.#p),process.stderr.on("resize",this.#d))}#p=()=>{this.isInteractive()&&(process.stderr.write(f),process.stderr.write(`${t}${process.stderr.rows};1H`),process.stderr.write(w))};#d=()=>{const s=process.stderr.rows-this.#r;this.#r=process.stderr.rows,this.#n(s)}}export{I as TerminalManager};
|
|
@@ -4,9 +4,8 @@ import type { MarkdocError } from '../../types/index.js';
|
|
|
4
4
|
export type FileInfo = {
|
|
5
5
|
relativePath: string;
|
|
6
6
|
realRelativePath: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
hash?: string;
|
|
7
|
+
isVirtual: boolean;
|
|
8
|
+
hash: string | undefined;
|
|
10
9
|
};
|
|
11
10
|
/**
|
|
12
11
|
* Information about fs acccess operations.
|
|
@@ -20,21 +19,17 @@ export type FileInfo = {
|
|
|
20
19
|
*/
|
|
21
20
|
export type AccessRecord = {
|
|
22
21
|
type: 'load';
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
loaderId: string;
|
|
23
|
+
resource: string;
|
|
25
24
|
hash: string;
|
|
26
25
|
} | {
|
|
27
|
-
type: 'read' | 'exists'
|
|
26
|
+
type: 'read' | 'exists';
|
|
28
27
|
path: string;
|
|
29
28
|
hash: string;
|
|
30
29
|
} | {
|
|
31
30
|
type: 'scan';
|
|
32
|
-
path: string;
|
|
33
31
|
hash: string;
|
|
34
32
|
pattern?: RegExp;
|
|
35
|
-
} | {
|
|
36
|
-
type: 'dependencies';
|
|
37
|
-
hash: string;
|
|
38
33
|
};
|
|
39
34
|
export type LoadResult<T> = {
|
|
40
35
|
/**
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ApiFunctionsBasicContext } from '../../types';
|
|
2
|
-
import type { LoggerStickyState } from '../../tools/notifiers/logger.js';
|
|
3
2
|
export type ApiRoutesWorkerParams = {
|
|
4
3
|
maxResponseSizeMB?: number;
|
|
5
4
|
slug: string;
|
|
@@ -22,7 +21,6 @@ export type ApiRoutesWorkerParams = {
|
|
|
22
21
|
referrer: string;
|
|
23
22
|
referrerPolicy: ReferrerPolicy;
|
|
24
23
|
};
|
|
25
|
-
loggerStickyState: LoggerStickyState;
|
|
26
24
|
sqldRemoteDatabaseUrl?: string;
|
|
27
25
|
sqldRemoteDatabaseAuthToken?: string;
|
|
28
26
|
};
|
|
@@ -33,6 +31,5 @@ export type ApiRoutesWorkerResponse = {
|
|
|
33
31
|
type: 'Buffer';
|
|
34
32
|
data: number[];
|
|
35
33
|
};
|
|
36
|
-
loggerStickyState: LoggerStickyState;
|
|
37
34
|
};
|
|
38
35
|
//# sourceMappingURL=api-routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function d(t){if(typeof t!="string")return!1;const e=new Date(t);return!isNaN(e.getTime())&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t)}export{d as isValidIsoDate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as i from"path";import{cliCommandNames as r}from"../../constants/common.js";import{PUBLIC_STATIC_FOLDER as t}from"../constants/common.js";import{logger as n}from"../tools/notifiers/logger.js";import{blue as s,gray as c}from"../tools/notifiers/helpers/colors.js";import{loadEnvVariables as f}from"./envs/load-env-variables.js";import{copyFolderRecursiveSync as l}from"./fs.js";import{validateInstalledVersion as a}from"./validate-installed-version.js";import{PACKAGE_NAME as E}from"../../config/product-gates.js";import{PORTAL_VERSION as P}from"../version.js";function u(e){return e?"true":"false"}function v(e){e["log-level"]&&(process.env.REDOCLY_LOG_LEVEL=String(e["log-level"])),process.env.INSPECT_MODE="inspect"in e?u(e.inspect):"false",e.pathPrefix&&(process.env.REDOCLY_PREFIX_PATHS=e.pathPrefix)}function L({contentDir:e,outdir:o}){l(i.join(e,t),i.join(o,t))}async function N(e,o,p){f(o["project-dir"]),process.env.REDOCLY_RUNNING_COMMAND=e;const m=e===r.DEVELOP?" Previewing with":"Building with";switch(n.logInFooter("product",`${m} ${s(`${E}@${P}`)}`),n.logInFooter("server",` \u{1F310} Preview URL: ${c("server starting...")}`),e){case r.DEVELOP:case r.BUILD:case r.PREPARE:v(o);break;default:break}await a(),L(p)}export{N as beforeCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function c(i){return"data"in i}function
|
|
1
|
+
import{logger as a}from"../tools/notifiers/logger.js";function c(i){return"data"in i}function o(i){return"execute"in i}class l{#t=[];#e=null;#s;#i;constructor(t){this.#a(t),this.#s=t.batchSize,this.#i=t.batchProcessor}async addItem(t){return new Promise((e,h)=>{if(o(t)){const r={execute:async(...n)=>{try{const s=await t.execute(...n);return e(s),s}catch(s){throw h(s),s}}};this.#t.push(r)}else if(c(t))this.#t.push(t),e(t.data);else{h(new Error("Invalid item type"));return}this.#h()})}#h(){this.#e||this.#t.length===0||this.#s&&this.#t.length<this.#s||(this.#e=this.#n().catch(t=>{a.error(`Batch queue processing failed: ${t.message}`)}).finally(()=>{this.#e=null,this.#t.length>0&&this.#h()}))}async#n(){for(;this.#t.length>=(this.#s??1);)await this.#r()}async processRemainingItems(){for(this.#e&&await this.#e;this.#t.length>0;)await this.#r()}async#r(){const t=this.#s??this.#t.length,e=this.#t.splice(0,t);e.length&&await this.#i(e)}#a(t){if(t.batchSize&&t.batchSize<=0)throw new Error("Batch size must be greater than 0")}get isProcessing(){return this.#e!==null}}export{l as BatchQueue,c as isDataItem,o as isExecutableItem};
|
|
@@ -3,12 +3,14 @@ import type { WildcardRedirectsTree } from '../../types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Finds a matching redirect configuration for a given slug.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* **IMPORTANT:** The `slug` parameter must be normalized before passing to this function.
|
|
7
|
+
* This function does NOT perform normalization internally.
|
|
8
|
+
*
|
|
7
9
|
* - First checks for a direct match in the `redirects` configuration.
|
|
8
10
|
* - If no direct match is found, searches for wildcard redirects (patterns ending with `*`).
|
|
9
11
|
* - For wildcard matches, preserves the remaining path after the wildcard prefix if the redirect target also ends with `*`.
|
|
10
12
|
*
|
|
11
|
-
* @param slug - The URL slug to find a redirect for.
|
|
13
|
+
* @param slug - The normalized (lowercased) URL slug to find a redirect for.
|
|
12
14
|
* @param redirects - The redirects configuration object.
|
|
13
15
|
* @param wildcardRedirectsTree - The wildcard redirects converted to a tree structure to optimize the search.
|
|
14
16
|
* @returns An object containing the redirect `to` URL and optional `type`, or `null` if no redirect is found.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{removeLeadingSlash as f}from"../../../utils/url/remove-leading-slash.js";function p(e,i,o){e=e.toLowerCase();const t=i[e];if(t&&t.to)return{to:t.to,type:t.type};const r=a(e,o);if(r){let n=i[r]?.to;if(n){if(n.endsWith("*")){const c=r.split("*")[0],d=e.substring(c.length);n=n.replace(/\*$/,d)}return{...i[r],to:n}}}return null}function a(e,i){const o=f(e).split("/");let t=i;for(const r of o){if(!t[r])break;t=t[r]}return t["*"]||null}export{p as findRedirect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import i from"node:path";import{withPathPrefix as f}from"@redocly/theme/core/utils";import{PUBLIC_STATIC_FOLDER as p}from"../constants/common.js";import{isLocalLink as u}from"../../utils/path/is-local-link.js";import{copyStaticFile as F,FileNotFoundError as d}from"./fs.js";async function h(r,n,o){if(!u(r))return r;const t=r.startsWith("/")?i.posix.join(p,r):void 0;if(t&&await n.exists(t))return f(r);const c=r.startsWith("/")?r.slice(1):i.posix.join(i.dirname(o.fromFileRelativePath),r),m=
|
|
1
|
+
import i from"node:path";import{withPathPrefix as f}from"@redocly/theme/core/utils";import{PUBLIC_STATIC_FOLDER as p}from"../constants/common.js";import{isLocalLink as u}from"../../utils/path/is-local-link.js";import{copyStaticFile as F,FileNotFoundError as d}from"./fs.js";async function h(r,n,o){if(!u(r))return r;const t=r.startsWith("/")?i.posix.join(p,r):void 0;if(t&&await n.exists(t))return f(r);const c=r.startsWith("/")?r.slice(1):i.posix.join(i.dirname(o.fromFileRelativePath),r),m=n.getFileInfo(c);if(!m)throw new d(`Cannot resolve asset path: ${r}`,r);return F(o.contentDir,m.realRelativePath,o.outdir)}export{h as resolveAssetPath};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(r){try{return{value:JSON.parse(r)}}catch(e){return{error:e}}}export{t as safeParse};
|