astro 4.3.7 → 4.4.1

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 (172) hide show
  1. package/components/Image.astro +4 -0
  2. package/components/Picture.astro +4 -0
  3. package/dist/@types/astro.d.ts +42 -42
  4. package/dist/assets/build/generate.d.ts +1 -1
  5. package/dist/assets/build/generate.js +1 -2
  6. package/dist/assets/internal.js +14 -0
  7. package/dist/assets/types.d.ts +23 -2
  8. package/dist/assets/utils/metadata.js +3 -3
  9. package/dist/assets/utils/remoteProbe.d.ts +2 -0
  10. package/dist/assets/utils/remoteProbe.js +35 -0
  11. package/dist/assets/utils/vendor/image-size/detector.d.ts +2 -0
  12. package/dist/assets/utils/vendor/image-size/detector.js +24 -0
  13. package/dist/assets/utils/vendor/image-size/lookup.d.ts +10 -0
  14. package/dist/assets/utils/vendor/image-size/lookup.js +26 -0
  15. package/dist/assets/utils/vendor/image-size/types/bmp.d.ts +2 -0
  16. package/dist/assets/utils/vendor/image-size/types/bmp.js +11 -0
  17. package/dist/assets/utils/vendor/image-size/types/cur.d.ts +2 -0
  18. package/dist/assets/utils/vendor/image-size/types/cur.js +17 -0
  19. package/dist/assets/utils/vendor/image-size/types/dds.d.ts +2 -0
  20. package/dist/assets/utils/vendor/image-size/types/dds.js +11 -0
  21. package/dist/assets/utils/vendor/image-size/types/gif.d.ts +2 -0
  22. package/dist/assets/utils/vendor/image-size/types/gif.js +12 -0
  23. package/dist/assets/utils/vendor/image-size/types/heif.d.ts +2 -0
  24. package/dist/assets/utils/vendor/image-size/types/heif.js +53 -0
  25. package/dist/assets/utils/vendor/image-size/types/icns.d.ts +2 -0
  26. package/dist/assets/utils/vendor/image-size/types/icns.js +85 -0
  27. package/dist/assets/utils/vendor/image-size/types/ico.d.ts +2 -0
  28. package/dist/assets/utils/vendor/image-size/types/ico.js +43 -0
  29. package/dist/assets/utils/vendor/image-size/types/index.d.ts +3 -0
  30. package/dist/assets/utils/vendor/image-size/types/index.js +43 -0
  31. package/dist/assets/utils/vendor/image-size/types/interface.d.ts +13 -0
  32. package/dist/assets/utils/vendor/image-size/types/interface.js +0 -0
  33. package/dist/assets/utils/vendor/image-size/types/j2c.d.ts +2 -0
  34. package/dist/assets/utils/vendor/image-size/types/j2c.js +12 -0
  35. package/dist/assets/utils/vendor/image-size/types/jp2.d.ts +2 -0
  36. package/dist/assets/utils/vendor/image-size/types/jp2.js +25 -0
  37. package/dist/assets/utils/vendor/image-size/types/jpg.d.ts +2 -0
  38. package/dist/assets/utils/vendor/image-size/types/jpg.js +97 -0
  39. package/dist/assets/utils/vendor/image-size/types/ktx.d.ts +2 -0
  40. package/dist/assets/utils/vendor/image-size/types/ktx.js +19 -0
  41. package/dist/assets/utils/vendor/image-size/types/png.d.ts +2 -0
  42. package/dist/assets/utils/vendor/image-size/types/png.js +34 -0
  43. package/dist/assets/utils/vendor/image-size/types/pnm.d.ts +2 -0
  44. package/dist/assets/utils/vendor/image-size/types/pnm.js +69 -0
  45. package/dist/assets/utils/vendor/image-size/types/psd.d.ts +2 -0
  46. package/dist/assets/utils/vendor/image-size/types/psd.js +11 -0
  47. package/dist/assets/utils/vendor/image-size/types/svg.d.ts +2 -0
  48. package/dist/assets/utils/vendor/image-size/types/svg.js +94 -0
  49. package/dist/assets/utils/vendor/image-size/types/tga.d.ts +2 -0
  50. package/dist/assets/utils/vendor/image-size/types/tga.js +15 -0
  51. package/dist/assets/utils/vendor/image-size/types/tiff.d.ts +2 -0
  52. package/dist/assets/utils/vendor/image-size/types/tiff.js +66 -0
  53. package/dist/assets/utils/vendor/image-size/types/utils.d.ts +15 -0
  54. package/dist/assets/utils/vendor/image-size/types/utils.js +60 -0
  55. package/dist/assets/utils/vendor/image-size/types/webp.d.ts +2 -0
  56. package/dist/assets/utils/vendor/image-size/types/webp.js +52 -0
  57. package/dist/cli/add/babel.d.ts +1 -1
  58. package/dist/cli/add/index.js +10 -3
  59. package/dist/cli/db/index.js +2 -0
  60. package/dist/cli/info/index.js +2 -0
  61. package/dist/cli/preferences/index.js +2 -0
  62. package/dist/content/runtime.js +3 -1
  63. package/dist/content/types-generator.js +7 -27
  64. package/dist/core/app/index.js +39 -122
  65. package/dist/core/app/pipeline.d.ts +7 -0
  66. package/dist/core/app/pipeline.js +39 -0
  67. package/dist/core/base-pipeline.d.ts +59 -0
  68. package/dist/core/base-pipeline.js +27 -0
  69. package/dist/core/build/generate.d.ts +1 -1
  70. package/dist/core/build/generate.js +39 -109
  71. package/dist/core/build/index.js +0 -4
  72. package/dist/core/build/{buildPipeline.d.ts → pipeline.d.ts} +13 -13
  73. package/dist/core/build/pipeline.js +180 -0
  74. package/dist/core/build/plugins/plugin-css.js +6 -5
  75. package/dist/core/build/plugins/plugin-hoisted-scripts.js +6 -5
  76. package/dist/core/build/plugins/util.d.ts +2 -1
  77. package/dist/core/build/plugins/util.js +12 -1
  78. package/dist/core/build/types.d.ts +0 -2
  79. package/dist/core/constants.d.ts +10 -1
  80. package/dist/core/constants.js +14 -4
  81. package/dist/core/dev/dev.js +1 -1
  82. package/dist/core/dev/restart.js +1 -1
  83. package/dist/core/endpoint/index.d.ts +5 -4
  84. package/dist/core/endpoint/index.js +7 -34
  85. package/dist/core/errors/errors-data.d.ts +16 -3
  86. package/dist/core/errors/errors-data.js +9 -2
  87. package/dist/core/messages.js +2 -2
  88. package/dist/core/middleware/callMiddleware.d.ts +1 -1
  89. package/dist/core/middleware/callMiddleware.js +2 -9
  90. package/dist/core/middleware/index.d.ts +2 -2
  91. package/dist/core/middleware/index.js +74 -9
  92. package/dist/core/module-loader/vite.js +4 -4
  93. package/dist/core/preview/index.js +2 -0
  94. package/dist/core/preview/static-preview-server.js +1 -7
  95. package/dist/core/redirects/helpers.d.ts +1 -3
  96. package/dist/core/redirects/helpers.js +0 -29
  97. package/dist/core/redirects/index.d.ts +2 -1
  98. package/dist/core/redirects/index.js +3 -3
  99. package/dist/core/redirects/render.d.ts +2 -0
  100. package/dist/core/redirects/render.js +33 -0
  101. package/dist/core/render/index.d.ts +7 -13
  102. package/dist/core/render/index.js +7 -7
  103. package/dist/core/render/params-and-props.d.ts +8 -3
  104. package/dist/core/render/params-and-props.js +24 -16
  105. package/dist/core/render/result.d.ts +6 -5
  106. package/dist/core/render/result.js +3 -4
  107. package/dist/core/render-context.d.ts +32 -0
  108. package/dist/core/render-context.js +219 -0
  109. package/dist/core/routing/index.d.ts +0 -1
  110. package/dist/core/routing/index.js +0 -2
  111. package/dist/core/routing/manifest/create.js +11 -27
  112. package/dist/core/routing/params.d.ts +1 -7
  113. package/dist/core/routing/params.js +0 -15
  114. package/dist/core/sync/index.js +3 -3
  115. package/dist/i18n/middleware.d.ts +0 -5
  116. package/dist/i18n/middleware.js +61 -69
  117. package/dist/i18n/utils.d.ts +25 -0
  118. package/dist/{core/render/context.js → i18n/utils.js} +3 -49
  119. package/dist/prerender/routing.d.ts +1 -1
  120. package/dist/prerender/routing.js +20 -21
  121. package/dist/runtime/client/dev-toolbar/apps/astro.js +14 -10
  122. package/dist/runtime/client/dev-toolbar/apps/audit/a11y.js +2 -2
  123. package/dist/runtime/client/dev-toolbar/apps/audit/index.d.ts +1 -1
  124. package/dist/runtime/client/dev-toolbar/apps/audit/index.js +115 -6
  125. package/dist/runtime/client/dev-toolbar/apps/audit/perf.d.ts +2 -0
  126. package/dist/runtime/client/dev-toolbar/apps/audit/perf.js +110 -0
  127. package/dist/runtime/client/dev-toolbar/apps/utils/highlight.d.ts +1 -1
  128. package/dist/runtime/client/dev-toolbar/apps/utils/highlight.js +6 -1
  129. package/dist/runtime/client/dev-toolbar/ui-library/card.js +1 -1
  130. package/dist/runtime/server/astro-island.js +10 -1
  131. package/dist/runtime/server/astro-island.prebuilt-dev.d.ts +7 -0
  132. package/dist/runtime/server/astro-island.prebuilt-dev.js +4 -0
  133. package/dist/runtime/server/astro-island.prebuilt.d.ts +1 -1
  134. package/dist/runtime/server/astro-island.prebuilt.js +1 -1
  135. package/dist/runtime/server/endpoint.js +2 -2
  136. package/dist/runtime/server/render/astro/render.d.ts +1 -0
  137. package/dist/runtime/server/render/astro/render.js +81 -2
  138. package/dist/runtime/server/render/component.js +6 -0
  139. package/dist/runtime/server/render/page.js +15 -2
  140. package/dist/runtime/server/render/util.d.ts +7 -0
  141. package/dist/runtime/server/render/util.js +15 -0
  142. package/dist/runtime/server/scripts.js +2 -4
  143. package/dist/runtime/server/transition.js +14 -1
  144. package/dist/vite-plugin-astro/hmr.d.ts +1 -0
  145. package/dist/vite-plugin-astro/hmr.js +7 -4
  146. package/dist/vite-plugin-astro-server/error.d.ts +2 -2
  147. package/dist/vite-plugin-astro-server/error.js +2 -5
  148. package/dist/vite-plugin-astro-server/index.d.ts +0 -6
  149. package/dist/vite-plugin-astro-server/index.js +0 -19
  150. package/dist/vite-plugin-astro-server/pipeline.d.ts +19 -0
  151. package/dist/vite-plugin-astro-server/pipeline.js +117 -0
  152. package/dist/vite-plugin-astro-server/plugin.js +3 -4
  153. package/dist/vite-plugin-astro-server/request.d.ts +3 -4
  154. package/dist/vite-plugin-astro-server/request.js +6 -9
  155. package/dist/vite-plugin-astro-server/route.d.ts +3 -4
  156. package/dist/vite-plugin-astro-server/route.js +34 -162
  157. package/dist/vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.js +3 -3
  158. package/package.json +7 -12
  159. package/dist/core/app/ssrPipeline.d.ts +0 -3
  160. package/dist/core/app/ssrPipeline.js +0 -6
  161. package/dist/core/build/buildPipeline.js +0 -150
  162. package/dist/core/pipeline.d.ts +0 -39
  163. package/dist/core/pipeline.js +0 -107
  164. package/dist/core/render/context.d.ts +0 -52
  165. package/dist/core/render/core.d.ts +0 -10
  166. package/dist/core/render/core.js +0 -65
  167. package/dist/core/render/environment.d.ts +0 -34
  168. package/dist/core/render/environment.js +0 -6
  169. package/dist/runtime/server/consts.d.ts +0 -1
  170. package/dist/runtime/server/consts.js +0 -4
  171. package/dist/vite-plugin-astro-server/devPipeline.d.ts +0 -22
  172. package/dist/vite-plugin-astro-server/devPipeline.js +0 -65
@@ -11,7 +11,7 @@ export declare const visit: {
11
11
  node: (node: traverse.Node, opts: traverse.TraverseOptions<traverse.Node>, scope?: traverse.Scope | undefined, state?: any, path?: traverse.NodePath<traverse.Node> | undefined, skipKeys?: Record<string, boolean> | undefined) => void;
12
12
  clearNode: (node: traverse.Node, opts?: traverse.RemovePropertiesOptions | undefined) => void;
13
13
  removeProperties: (tree: traverse.Node, opts?: traverse.RemovePropertiesOptions | undefined) => traverse.Node;
14
- hasType: (tree: traverse.Node, type: "CatchClause" | "ClassBody" | "Identifier" | "Program" | "SpreadElement" | "Super" | "SwitchCase" | "TemplateElement" | "VariableDeclarator" | "ArrayExpression" | "ArrowFunctionExpression" | "AssignmentExpression" | "AwaitExpression" | "BinaryExpression" | "CallExpression" | "ClassExpression" | "ConditionalExpression" | "FunctionExpression" | "ImportExpression" | "LogicalExpression" | "MemberExpression" | "MetaProperty" | "NewExpression" | "ObjectExpression" | "SequenceExpression" | "TaggedTemplateExpression" | "TemplateLiteral" | "ThisExpression" | "UnaryExpression" | "UpdateExpression" | "YieldExpression" | "ClassDeclaration" | "FunctionDeclaration" | "ImportDeclaration" | "ExportNamedDeclaration" | "ExportDefaultDeclaration" | "ExportAllDeclaration" | "ExpressionStatement" | "BlockStatement" | "StaticBlock" | "EmptyStatement" | "DebuggerStatement" | "WithStatement" | "ReturnStatement" | "LabeledStatement" | "BreakStatement" | "ContinueStatement" | "IfStatement" | "SwitchStatement" | "ThrowStatement" | "TryStatement" | "WhileStatement" | "DoWhileStatement" | "ForStatement" | "ForInStatement" | "ForOfStatement" | "VariableDeclaration" | "AnyTypeAnnotation" | "ArgumentPlaceholder" | "ArrayPattern" | "ArrayTypeAnnotation" | "AssignmentPattern" | "BigIntLiteral" | "BindExpression" | "BooleanLiteral" | "BooleanLiteralTypeAnnotation" | "BooleanTypeAnnotation" | "ClassAccessorProperty" | "ClassImplements" | "ClassMethod" | "ClassPrivateMethod" | "ClassPrivateProperty" | "ClassProperty" | "DecimalLiteral" | "DeclareClass" | "DeclareExportAllDeclaration" | "DeclareExportDeclaration" | "DeclareFunction" | "DeclareInterface" | "DeclareModule" | "DeclareModuleExports" | "DeclareOpaqueType" | "DeclareTypeAlias" | "DeclareVariable" | "DeclaredPredicate" | "Decorator" | "Directive" | "DirectiveLiteral" | "DoExpression" | "EmptyTypeAnnotation" | "EnumBooleanBody" | "EnumBooleanMember" | "EnumDeclaration" | "EnumDefaultedMember" | "EnumNumberBody" | "EnumNumberMember" | "EnumStringBody" | "EnumStringMember" | "EnumSymbolBody" | "ExistsTypeAnnotation" | "ExportDefaultSpecifier" | "ExportNamespaceSpecifier" | "ExportSpecifier" | "File" | "FunctionTypeAnnotation" | "FunctionTypeParam" | "GenericTypeAnnotation" | "Import" | "ImportAttribute" | "ImportDefaultSpecifier" | "ImportNamespaceSpecifier" | "ImportSpecifier" | "IndexedAccessType" | "InferredPredicate" | "InterfaceDeclaration" | "InterfaceExtends" | "InterfaceTypeAnnotation" | "InterpreterDirective" | "IntersectionTypeAnnotation" | "JSXAttribute" | "JSXClosingElement" | "JSXClosingFragment" | "JSXElement" | "JSXEmptyExpression" | "JSXExpressionContainer" | "JSXFragment" | "JSXIdentifier" | "JSXMemberExpression" | "JSXNamespacedName" | "JSXOpeningElement" | "JSXOpeningFragment" | "JSXSpreadAttribute" | "JSXSpreadChild" | "JSXText" | "MixedTypeAnnotation" | "ModuleExpression" | "Noop" | "NullLiteral" | "NullLiteralTypeAnnotation" | "NullableTypeAnnotation" | "NumberLiteral" | "NumberLiteralTypeAnnotation" | "NumberTypeAnnotation" | "NumericLiteral" | "ObjectMethod" | "ObjectPattern" | "ObjectProperty" | "ObjectTypeAnnotation" | "ObjectTypeCallProperty" | "ObjectTypeIndexer" | "ObjectTypeInternalSlot" | "ObjectTypeProperty" | "ObjectTypeSpreadProperty" | "OpaqueType" | "OptionalCallExpression" | "OptionalIndexedAccessType" | "OptionalMemberExpression" | "ParenthesizedExpression" | "PipelineBareFunction" | "PipelinePrimaryTopicReference" | "PipelineTopicExpression" | "Placeholder" | "PrivateName" | "QualifiedTypeIdentifier" | "RecordExpression" | "RegExpLiteral" | "RegexLiteral" | "RestElement" | "RestProperty" | "SpreadProperty" | "StringLiteral" | "StringLiteralTypeAnnotation" | "StringTypeAnnotation" | "SymbolTypeAnnotation" | "TSAnyKeyword" | "TSArrayType" | "TSAsExpression" | "TSBigIntKeyword" | "TSBooleanKeyword" | "TSCallSignatureDeclaration" | "TSConditionalType" | "TSConstructSignatureDeclaration" | "TSConstructorType" | "TSDeclareFunction" | "TSDeclareMethod" | "TSEnumDeclaration" | "TSEnumMember" | "TSExportAssignment" | "TSExpressionWithTypeArguments" | "TSExternalModuleReference" | "TSFunctionType" | "TSImportEqualsDeclaration" | "TSImportType" | "TSIndexSignature" | "TSIndexedAccessType" | "TSInferType" | "TSInstantiationExpression" | "TSInterfaceBody" | "TSInterfaceDeclaration" | "TSIntersectionType" | "TSIntrinsicKeyword" | "TSLiteralType" | "TSMappedType" | "TSMethodSignature" | "TSModuleBlock" | "TSModuleDeclaration" | "TSNamedTupleMember" | "TSNamespaceExportDeclaration" | "TSNeverKeyword" | "TSNonNullExpression" | "TSNullKeyword" | "TSNumberKeyword" | "TSObjectKeyword" | "TSOptionalType" | "TSParameterProperty" | "TSParenthesizedType" | "TSPropertySignature" | "TSQualifiedName" | "TSRestType" | "TSSatisfiesExpression" | "TSStringKeyword" | "TSSymbolKeyword" | "TSThisType" | "TSTupleType" | "TSTypeAliasDeclaration" | "TSTypeAnnotation" | "TSTypeAssertion" | "TSTypeLiteral" | "TSTypeOperator" | "TSTypeParameter" | "TSTypeParameterDeclaration" | "TSTypeParameterInstantiation" | "TSTypePredicate" | "TSTypeQuery" | "TSTypeReference" | "TSUndefinedKeyword" | "TSUnionType" | "TSUnknownKeyword" | "TSVoidKeyword" | "ThisTypeAnnotation" | "TopicReference" | "TupleExpression" | "TupleTypeAnnotation" | "TypeAlias" | "TypeAnnotation" | "TypeCastExpression" | "TypeParameter" | "TypeParameterDeclaration" | "TypeParameterInstantiation" | "TypeofTypeAnnotation" | "UnionTypeAnnotation" | "V8IntrinsicIdentifier" | "Variance" | "VoidTypeAnnotation", denylistTypes?: string[] | undefined) => boolean;
14
+ hasType: (tree: traverse.Node, type: "File" | "CatchClause" | "ClassBody" | "Identifier" | "Program" | "SpreadElement" | "Super" | "SwitchCase" | "TemplateElement" | "VariableDeclarator" | "ArrayExpression" | "ArrowFunctionExpression" | "AssignmentExpression" | "AwaitExpression" | "BinaryExpression" | "CallExpression" | "ClassExpression" | "ConditionalExpression" | "FunctionExpression" | "ImportExpression" | "LogicalExpression" | "MemberExpression" | "MetaProperty" | "NewExpression" | "ObjectExpression" | "SequenceExpression" | "TaggedTemplateExpression" | "TemplateLiteral" | "ThisExpression" | "UnaryExpression" | "UpdateExpression" | "YieldExpression" | "ClassDeclaration" | "FunctionDeclaration" | "ImportDeclaration" | "ExportNamedDeclaration" | "ExportDefaultDeclaration" | "ExportAllDeclaration" | "ExpressionStatement" | "BlockStatement" | "StaticBlock" | "EmptyStatement" | "DebuggerStatement" | "WithStatement" | "ReturnStatement" | "LabeledStatement" | "BreakStatement" | "ContinueStatement" | "IfStatement" | "SwitchStatement" | "ThrowStatement" | "TryStatement" | "WhileStatement" | "DoWhileStatement" | "ForStatement" | "ForInStatement" | "ForOfStatement" | "VariableDeclaration" | "AnyTypeAnnotation" | "ArgumentPlaceholder" | "ArrayPattern" | "ArrayTypeAnnotation" | "AssignmentPattern" | "BigIntLiteral" | "BindExpression" | "BooleanLiteral" | "BooleanLiteralTypeAnnotation" | "BooleanTypeAnnotation" | "ClassAccessorProperty" | "ClassImplements" | "ClassMethod" | "ClassPrivateMethod" | "ClassPrivateProperty" | "ClassProperty" | "DecimalLiteral" | "DeclareClass" | "DeclareExportAllDeclaration" | "DeclareExportDeclaration" | "DeclareFunction" | "DeclareInterface" | "DeclareModule" | "DeclareModuleExports" | "DeclareOpaqueType" | "DeclareTypeAlias" | "DeclareVariable" | "DeclaredPredicate" | "Decorator" | "Directive" | "DirectiveLiteral" | "DoExpression" | "EmptyTypeAnnotation" | "EnumBooleanBody" | "EnumBooleanMember" | "EnumDeclaration" | "EnumDefaultedMember" | "EnumNumberBody" | "EnumNumberMember" | "EnumStringBody" | "EnumStringMember" | "EnumSymbolBody" | "ExistsTypeAnnotation" | "ExportDefaultSpecifier" | "ExportNamespaceSpecifier" | "ExportSpecifier" | "FunctionTypeAnnotation" | "FunctionTypeParam" | "GenericTypeAnnotation" | "Import" | "ImportAttribute" | "ImportDefaultSpecifier" | "ImportNamespaceSpecifier" | "ImportSpecifier" | "IndexedAccessType" | "InferredPredicate" | "InterfaceDeclaration" | "InterfaceExtends" | "InterfaceTypeAnnotation" | "InterpreterDirective" | "IntersectionTypeAnnotation" | "JSXAttribute" | "JSXClosingElement" | "JSXClosingFragment" | "JSXElement" | "JSXEmptyExpression" | "JSXExpressionContainer" | "JSXFragment" | "JSXIdentifier" | "JSXMemberExpression" | "JSXNamespacedName" | "JSXOpeningElement" | "JSXOpeningFragment" | "JSXSpreadAttribute" | "JSXSpreadChild" | "JSXText" | "MixedTypeAnnotation" | "ModuleExpression" | "Noop" | "NullLiteral" | "NullLiteralTypeAnnotation" | "NullableTypeAnnotation" | "NumberLiteral" | "NumberLiteralTypeAnnotation" | "NumberTypeAnnotation" | "NumericLiteral" | "ObjectMethod" | "ObjectPattern" | "ObjectProperty" | "ObjectTypeAnnotation" | "ObjectTypeCallProperty" | "ObjectTypeIndexer" | "ObjectTypeInternalSlot" | "ObjectTypeProperty" | "ObjectTypeSpreadProperty" | "OpaqueType" | "OptionalCallExpression" | "OptionalIndexedAccessType" | "OptionalMemberExpression" | "ParenthesizedExpression" | "PipelineBareFunction" | "PipelinePrimaryTopicReference" | "PipelineTopicExpression" | "Placeholder" | "PrivateName" | "QualifiedTypeIdentifier" | "RecordExpression" | "RegExpLiteral" | "RegexLiteral" | "RestElement" | "RestProperty" | "SpreadProperty" | "StringLiteral" | "StringLiteralTypeAnnotation" | "StringTypeAnnotation" | "SymbolTypeAnnotation" | "TSAnyKeyword" | "TSArrayType" | "TSAsExpression" | "TSBigIntKeyword" | "TSBooleanKeyword" | "TSCallSignatureDeclaration" | "TSConditionalType" | "TSConstructSignatureDeclaration" | "TSConstructorType" | "TSDeclareFunction" | "TSDeclareMethod" | "TSEnumDeclaration" | "TSEnumMember" | "TSExportAssignment" | "TSExpressionWithTypeArguments" | "TSExternalModuleReference" | "TSFunctionType" | "TSImportEqualsDeclaration" | "TSImportType" | "TSIndexSignature" | "TSIndexedAccessType" | "TSInferType" | "TSInstantiationExpression" | "TSInterfaceBody" | "TSInterfaceDeclaration" | "TSIntersectionType" | "TSIntrinsicKeyword" | "TSLiteralType" | "TSMappedType" | "TSMethodSignature" | "TSModuleBlock" | "TSModuleDeclaration" | "TSNamedTupleMember" | "TSNamespaceExportDeclaration" | "TSNeverKeyword" | "TSNonNullExpression" | "TSNullKeyword" | "TSNumberKeyword" | "TSObjectKeyword" | "TSOptionalType" | "TSParameterProperty" | "TSParenthesizedType" | "TSPropertySignature" | "TSQualifiedName" | "TSRestType" | "TSSatisfiesExpression" | "TSStringKeyword" | "TSSymbolKeyword" | "TSThisType" | "TSTupleType" | "TSTypeAliasDeclaration" | "TSTypeAnnotation" | "TSTypeAssertion" | "TSTypeLiteral" | "TSTypeOperator" | "TSTypeParameter" | "TSTypeParameterDeclaration" | "TSTypeParameterInstantiation" | "TSTypePredicate" | "TSTypeQuery" | "TSTypeReference" | "TSUndefinedKeyword" | "TSUnionType" | "TSUnknownKeyword" | "TSVoidKeyword" | "ThisTypeAnnotation" | "TopicReference" | "TupleExpression" | "TupleTypeAnnotation" | "TypeAlias" | "TypeAnnotation" | "TypeCastExpression" | "TypeParameter" | "TypeParameterDeclaration" | "TypeParameterInstantiation" | "TypeofTypeAnnotation" | "UnionTypeAnnotation" | "V8IntrinsicIdentifier" | "Variance" | "VoidTypeAnnotation", denylistTypes?: string[] | undefined) => boolean;
15
15
  cache: typeof traverse.cache;
16
16
  };
17
17
  export { t };
@@ -61,21 +61,28 @@ const OFFICIAL_ADAPTER_TO_IMPORT_MAP = {
61
61
  cloudflare: "@astrojs/cloudflare",
62
62
  node: "@astrojs/node"
63
63
  };
64
+ let _registry;
64
65
  async function getRegistry() {
66
+ if (_registry)
67
+ return _registry;
68
+ const fallback = "https://registry.npmjs.org";
65
69
  const packageManager = (await preferredPM(process.cwd()))?.name || "npm";
66
70
  try {
67
71
  const { stdout } = await execa(packageManager, ["config", "get", "registry"]);
68
- return stdout?.trim()?.replace(/\/$/, "") || "https://registry.npmjs.org";
72
+ _registry = stdout?.trim()?.replace(/\/$/, "") || fallback;
73
+ if (!new URL(_registry).host)
74
+ _registry = fallback;
69
75
  } catch (e) {
70
- return "https://registry.npmjs.org";
76
+ _registry = fallback;
71
77
  }
78
+ return _registry;
72
79
  }
73
80
  async function add(names, { flags }) {
74
81
  ensureProcessNodeEnv("production");
82
+ applyPolyfill();
75
83
  const inlineConfig = flagsToAstroInlineConfig(flags);
76
84
  const { userConfig } = await resolveConfig(inlineConfig, "add");
77
85
  telemetry.record(eventCliSession("add", userConfig));
78
- applyPolyfill();
79
86
  if (flags.help || names.length === 0) {
80
87
  printHelp({
81
88
  commandName: "astro add",
@@ -1,7 +1,9 @@
1
1
  import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
2
2
  import { getPackage } from "../install-package.js";
3
3
  import { resolveConfig } from "../../core/config/config.js";
4
+ import { apply as applyPolyfill } from "../../core/polyfill.js";
4
5
  async function db({ flags }) {
6
+ applyPolyfill();
5
7
  const logger = createLoggerFromFlags(flags);
6
8
  const getPackageOpts = { skipAsk: flags.yes || flags.y, cwd: flags.root };
7
9
  const dbPackage = await getPackage("@astrojs/db", logger, getPackageOpts, []);
@@ -5,6 +5,7 @@ import prompts from "prompts";
5
5
  import { resolveConfig } from "../../core/config/index.js";
6
6
  import { ASTRO_VERSION } from "../../core/constants.js";
7
7
  import { flagsToAstroInlineConfig } from "../flags.js";
8
+ import { apply as applyPolyfill } from "../../core/polyfill.js";
8
9
  async function getInfoOutput({
9
10
  userConfig,
10
11
  print
@@ -29,6 +30,7 @@ async function getInfoOutput({
29
30
  return output.trim();
30
31
  }
31
32
  async function printInfo({ flags }) {
33
+ applyPolyfill();
32
34
  const { userConfig } = await resolveConfig(flagsToAstroInlineConfig(flags), "info");
33
35
  const output = await getInfoOutput({ userConfig, print: true });
34
36
  await copyToClipboard(output);
@@ -10,6 +10,7 @@ import { createLoggerFromFlags, flagsToAstroInlineConfig } from "../flags.js";
10
10
  import { flattie } from "flattie";
11
11
  import { formatWithOptions } from "node:util";
12
12
  import { collectErrorMetadata } from "../../core/errors/dev/utils.js";
13
+ import { apply as applyPolyfill } from "../../core/polyfill.js";
13
14
  const PREFERENCES_SUBCOMMANDS = [
14
15
  "get",
15
16
  "set",
@@ -23,6 +24,7 @@ function isValidSubcommand(subcommand) {
23
24
  return PREFERENCES_SUBCOMMANDS.includes(subcommand);
24
25
  }
25
26
  async function preferences(subcommand, key, value, { flags }) {
27
+ applyPolyfill();
26
28
  if (!isValidSubcommand(subcommand) || flags?.help || flags?.h) {
27
29
  msg.printHelp({
28
30
  commandName: "astro preferences",
@@ -45,7 +45,9 @@ function createGetCollection({
45
45
  type = "data";
46
46
  } else {
47
47
  console.warn(
48
- `The collection **${collection}** does not exist or is empty. Ensure a collection directory with this name exists.`
48
+ `The collection ${JSON.stringify(
49
+ collection
50
+ )} does not exist or is empty. Ensure a collection directory with this name exists.`
49
51
  );
50
52
  return;
51
53
  }
@@ -121,7 +121,7 @@ async function createContentTypesGenerator({
121
121
  }
122
122
  const collectionInfo2 = collectionEntryMap[collectionKey2];
123
123
  if (collectionInfo2.type === "content") {
124
- viteServer.ws.send({
124
+ viteServer.hot.send({
125
125
  type: "error",
126
126
  err: new AstroError({
127
127
  ...AstroErrorData.MixedContentDataCollectionError,
@@ -157,7 +157,7 @@ async function createContentTypesGenerator({
157
157
  }
158
158
  const collectionInfo = collectionEntryMap[collectionKey];
159
159
  if (collectionInfo.type === "data") {
160
- viteServer.ws.send({
160
+ viteServer.hot.send({
161
161
  type: "error",
162
162
  err: new AstroError({
163
163
  ...AstroErrorData.MixedContentDataCollectionError,
@@ -247,13 +247,6 @@ async function createContentTypesGenerator({
247
247
  viteServer
248
248
  });
249
249
  invalidateVirtualMod(viteServer);
250
- if (observable.status === "loaded") {
251
- warnNonexistentCollections({
252
- logger,
253
- contentConfig: observable.config,
254
- collectionEntryMap
255
- });
256
- }
257
250
  }
258
251
  }
259
252
  return { init, queueEvent };
@@ -280,11 +273,14 @@ async function writeContentFiles({
280
273
  }) {
281
274
  let contentTypesStr = "";
282
275
  let dataTypesStr = "";
276
+ for (const [collection, config] of Object.entries(contentConfig?.collections ?? {})) {
277
+ collectionEntryMap[JSON.stringify(collection)] ??= { type: config.type, entries: {} };
278
+ }
283
279
  for (const collectionKey of Object.keys(collectionEntryMap).sort()) {
284
280
  const collectionConfig = contentConfig?.collections[JSON.parse(collectionKey)];
285
281
  const collection = collectionEntryMap[collectionKey];
286
282
  if (collectionConfig?.type && collection.type !== "unknown" && collection.type !== collectionConfig.type) {
287
- viteServer.ws.send({
283
+ viteServer.hot.send({
288
284
  type: "error",
289
285
  err: new AstroError({
290
286
  ...AstroErrorData.ContentCollectionTypeMismatchError,
@@ -296,7 +292,7 @@ async function writeContentFiles({
296
292
  hint: collection.type === "data" ? "Try adding `type: 'data'` to your collection config." : void 0,
297
293
  location: {
298
294
  file: ""
299
- /** required for error overlay `ws` messages */
295
+ /** required for error overlay `hot` messages */
300
296
  }
301
297
  })
302
298
  });
@@ -370,22 +366,6 @@ async function writeContentFiles({
370
366
  typeTemplateContent
371
367
  );
372
368
  }
373
- function warnNonexistentCollections({
374
- contentConfig,
375
- collectionEntryMap,
376
- logger
377
- }) {
378
- for (const configuredCollection in contentConfig.collections) {
379
- if (!collectionEntryMap[JSON.stringify(configuredCollection)]) {
380
- logger.warn(
381
- "content",
382
- `The ${bold(configuredCollection)} collection is defined but no ${bold(
383
- "content/" + configuredCollection
384
- )} folder exists in the content directory. Create a new folder for the collection, or check your content configuration file for typos.`
385
- );
386
- }
387
- }
388
- }
389
369
  export {
390
370
  createContentTypesGenerator
391
371
  };
@@ -1,9 +1,6 @@
1
- import { createI18nMiddleware, i18nPipelineHook } from "../../i18n/middleware.js";
2
- import { REROUTE_DIRECTIVE_HEADER } from "../../runtime/server/consts.js";
3
1
  import { getSetCookiesFromResponse } from "../cookies/index.js";
4
2
  import { consoleLogDestination } from "../logger/console.js";
5
3
  import { AstroIntegrationLogger, Logger } from "../logger/core.js";
6
- import { sequence } from "../middleware/index.js";
7
4
  import {
8
5
  appendForwardSlash,
9
6
  collapseDuplicateSlashes,
@@ -12,28 +9,23 @@ import {
12
9
  removeTrailingForwardSlash
13
10
  } from "../path.js";
14
11
  import { RedirectSinglePageBuiltModule } from "../redirects/index.js";
15
- import { createEnvironment, createRenderContext } from "../render/index.js";
16
- import { RouteCache } from "../render/route-cache.js";
17
- import {
18
- createAssetLink,
19
- createModuleScriptElement,
20
- createStylesheetElementSet
21
- } from "../render/ssr-element.js";
12
+ import { createAssetLink } from "../render/ssr-element.js";
22
13
  import { matchRoute } from "../routing/match.js";
23
- import { SSRRoutePipeline } from "./ssrPipeline.js";
14
+ import { AppPipeline } from "./pipeline.js";
24
15
  import { normalizeTheLocale } from "../../i18n/index.js";
16
+ import { RenderContext } from "../render-context.js";
17
+ import {
18
+ clientAddressSymbol,
19
+ clientLocalsSymbol,
20
+ responseSentSymbol,
21
+ REROUTABLE_STATUS_CODES,
22
+ REROUTE_DIRECTIVE_HEADER
23
+ } from "../constants.js";
24
+ import { AstroError, AstroErrorData } from "../errors/index.js";
25
25
  import { deserializeManifest } from "./common.js";
26
- const localsSymbol = Symbol.for("astro.locals");
27
- const clientAddressSymbol = Symbol.for("astro.clientAddress");
28
- const responseSentSymbol = Symbol.for("astro.responseSent");
29
- const REROUTABLE_STATUS_CODES = /* @__PURE__ */ new Set([404, 500]);
30
26
  class App {
31
- /**
32
- * The current environment of the application
33
- */
34
27
  #manifest;
35
28
  #manifestData;
36
- #routeDataToRouteInfo;
37
29
  #logger = new Logger({
38
30
  dest: consoleLogDestination,
39
31
  level: "info"
@@ -47,9 +39,8 @@ class App {
47
39
  this.#manifestData = {
48
40
  routes: manifest.routes.map((route) => route.routeData)
49
41
  };
50
- this.#routeDataToRouteInfo = new Map(manifest.routes.map((route) => [route.routeData, route]));
51
42
  this.#baseWithoutTrailingSlash = removeTrailingForwardSlash(this.#manifest.base);
52
- this.#pipeline = new SSRRoutePipeline(this.#createEnvironment(streaming));
43
+ this.#pipeline = this.#createPipeline(streaming);
53
44
  this.#adapterLogger = new AstroIntegrationLogger(
54
45
  this.#logger.options,
55
46
  this.#manifest.adapterName
@@ -59,19 +50,17 @@ class App {
59
50
  return this.#adapterLogger;
60
51
  }
61
52
  /**
62
- * Creates an environment by reading the stored manifest
53
+ * Creates a pipeline by reading the stored manifest
63
54
  *
64
55
  * @param streaming
65
56
  * @private
66
57
  */
67
- #createEnvironment(streaming = false) {
68
- return createEnvironment({
69
- adapterName: this.#manifest.adapterName,
58
+ #createPipeline(streaming = false) {
59
+ return AppPipeline.create({
70
60
  logger: this.#logger,
61
+ manifest: this.#manifest,
71
62
  mode: "production",
72
- compressHTML: this.#manifest.compressHTML,
73
63
  renderers: this.#manifest.renderers,
74
- clientDirectives: this.#manifest.clientDirectives,
75
64
  resolve: async (specifier) => {
76
65
  if (!(specifier in this.#manifest.entryModules)) {
77
66
  throw new Error(`Unable to resolve [${specifier}]`);
@@ -87,9 +76,7 @@ class App {
87
76
  }
88
77
  }
89
78
  },
90
- routeCache: new RouteCache(this.#logger),
91
- site: this.#manifest.site,
92
- ssr: true,
79
+ serverLike: true,
93
80
  streaming
94
81
  });
95
82
  }
@@ -193,7 +180,11 @@ class App {
193
180
  }
194
181
  }
195
182
  if (locals) {
196
- Reflect.set(request, localsSymbol, locals);
183
+ if (typeof locals !== "object") {
184
+ this.#logger.error(null, new AstroError(AstroErrorData.LocalsNotAnObject).stack);
185
+ return this.#renderError(request, { status: 500 });
186
+ }
187
+ Reflect.set(request, clientLocalsSymbol, locals);
197
188
  }
198
189
  if (clientAddress) {
199
190
  Reflect.set(request, clientAddressSymbol, clientAddress);
@@ -210,35 +201,22 @@ class App {
210
201
  const pathname = this.#getPathnameFromRequest(request);
211
202
  const defaultStatus = this.#getDefaultStatusCode(routeData, pathname);
212
203
  const mod = await this.#getModuleForRoute(routeData);
213
- const pageModule = await mod.page();
214
- const url = new URL(request.url);
215
- const renderContext = await this.#createRenderContext(
216
- url,
217
- request,
218
- routeData,
219
- mod,
220
- defaultStatus
221
- );
222
204
  let response;
223
205
  try {
224
- const i18nMiddleware = createI18nMiddleware(
225
- this.#manifest.i18n,
226
- this.#manifest.base,
227
- this.#manifest.trailingSlash,
228
- this.#manifest.buildFormat
229
- );
230
- if (i18nMiddleware) {
231
- this.#pipeline.setMiddlewareFunction(sequence(i18nMiddleware, this.#manifest.middleware));
232
- this.#pipeline.onBeforeRenderRoute(i18nPipelineHook);
233
- } else {
234
- this.#pipeline.setMiddlewareFunction(this.#manifest.middleware);
235
- }
236
- response = await this.#pipeline.renderRoute(renderContext, pageModule);
206
+ const renderContext = RenderContext.create({
207
+ pipeline: this.#pipeline,
208
+ locals,
209
+ pathname,
210
+ request,
211
+ routeData,
212
+ status: defaultStatus
213
+ });
214
+ response = await renderContext.render(await mod.page());
237
215
  } catch (err) {
238
216
  this.#logger.error(null, err.stack || err.message || String(err));
239
217
  return this.#renderError(request, { status: 500 });
240
218
  }
241
- if (REROUTABLE_STATUS_CODES.has(response.status) && response.headers.get(REROUTE_DIRECTIVE_HEADER) !== "no") {
219
+ if (REROUTABLE_STATUS_CODES.includes(response.status) && response.headers.get(REROUTE_DIRECTIVE_HEADER) !== "no") {
242
220
  return this.#renderError(request, {
243
221
  response,
244
222
  status: response.status
@@ -279,61 +257,6 @@ class App {
279
257
  * @returns An iterator that yields key-value pairs as equal-sign-separated strings.
280
258
  */
281
259
  static getSetCookieFromResponse = getSetCookiesFromResponse;
282
- /**
283
- * Creates the render context of the current route
284
- */
285
- async #createRenderContext(url, request, routeData, page, status = 200) {
286
- if (routeData.type === "endpoint") {
287
- const pathname = "/" + this.removeBase(url.pathname);
288
- const mod = await page.page();
289
- const handler = mod;
290
- return await createRenderContext({
291
- request,
292
- pathname,
293
- route: routeData,
294
- status,
295
- env: this.#pipeline.env,
296
- mod: handler,
297
- locales: this.#manifest.i18n?.locales,
298
- routing: this.#manifest.i18n?.routing,
299
- defaultLocale: this.#manifest.i18n?.defaultLocale
300
- });
301
- } else {
302
- const pathname = prependForwardSlash(this.removeBase(url.pathname));
303
- const info = this.#routeDataToRouteInfo.get(routeData);
304
- const links = /* @__PURE__ */ new Set();
305
- const styles = createStylesheetElementSet(info.styles);
306
- let scripts = /* @__PURE__ */ new Set();
307
- for (const script of info.scripts) {
308
- if ("stage" in script) {
309
- if (script.stage === "head-inline") {
310
- scripts.add({
311
- props: {},
312
- children: script.children
313
- });
314
- }
315
- } else {
316
- scripts.add(createModuleScriptElement(script));
317
- }
318
- }
319
- const mod = await page.page();
320
- return await createRenderContext({
321
- request,
322
- pathname,
323
- componentMetadata: this.#manifest.componentMetadata,
324
- scripts,
325
- styles,
326
- links,
327
- route: routeData,
328
- status,
329
- mod,
330
- env: this.#pipeline.env,
331
- locales: this.#manifest.i18n?.locales,
332
- routing: this.#manifest.i18n?.routing,
333
- defaultLocale: this.#manifest.i18n?.defaultLocale
334
- });
335
- }
336
- }
337
260
  /**
338
261
  * If it is a known error code, try sending the according page (e.g. 404.astro / 500.astro).
339
262
  * This also handles pre-rendered /404 or /500 routes
@@ -355,21 +278,15 @@ class App {
355
278
  }
356
279
  const mod = await this.#getModuleForRoute(errorRouteData);
357
280
  try {
358
- const newRenderContext = await this.#createRenderContext(
359
- url,
281
+ const renderContext = RenderContext.create({
282
+ pipeline: this.#pipeline,
283
+ middleware: skipMiddleware ? (_, next) => next() : void 0,
284
+ pathname: this.#getPathnameFromRequest(request),
360
285
  request,
361
- errorRouteData,
362
- mod,
286
+ routeData: errorRouteData,
363
287
  status
364
- );
365
- const page = await mod.page();
366
- if (skipMiddleware === false) {
367
- this.#pipeline.setMiddlewareFunction(this.#manifest.middleware);
368
- }
369
- if (skipMiddleware) {
370
- this.#pipeline.unsetMiddlewareFunction();
371
- }
372
- const response2 = await this.#pipeline.renderRoute(newRenderContext, page);
288
+ });
289
+ const response2 = await renderContext.render(await mod.page());
373
290
  return this.#mergeResponses(response2, originalResponse);
374
291
  } catch {
375
292
  if (skipMiddleware === false) {
@@ -0,0 +1,7 @@
1
+ import type { RouteData, SSRResult } from '../../@types/astro.js';
2
+ import { Pipeline } from '../base-pipeline.js';
3
+ export declare class AppPipeline extends Pipeline {
4
+ static create({ logger, manifest, mode, renderers, resolve, serverLike, streaming, }: Pick<AppPipeline, 'logger' | 'manifest' | 'mode' | 'renderers' | 'resolve' | 'serverLike' | 'streaming'>): AppPipeline;
5
+ headElements(routeData: RouteData): Pick<SSRResult, 'scripts' | 'styles' | 'links'>;
6
+ componentMetadata(): void;
7
+ }
@@ -0,0 +1,39 @@
1
+ import { Pipeline } from "../base-pipeline.js";
2
+ import { createModuleScriptElement, createStylesheetElementSet } from "../render/ssr-element.js";
3
+ class AppPipeline extends Pipeline {
4
+ static create({
5
+ logger,
6
+ manifest,
7
+ mode,
8
+ renderers,
9
+ resolve,
10
+ serverLike,
11
+ streaming
12
+ }) {
13
+ return new AppPipeline(logger, manifest, mode, renderers, resolve, serverLike, streaming);
14
+ }
15
+ headElements(routeData) {
16
+ const routeInfo = this.manifest.routes.find((route) => route.routeData === routeData);
17
+ const links = /* @__PURE__ */ new Set();
18
+ const scripts = /* @__PURE__ */ new Set();
19
+ const styles = createStylesheetElementSet(routeInfo?.styles ?? []);
20
+ for (const script of routeInfo?.scripts ?? []) {
21
+ if ("stage" in script) {
22
+ if (script.stage === "head-inline") {
23
+ scripts.add({
24
+ props: {},
25
+ children: script.children
26
+ });
27
+ }
28
+ } else {
29
+ scripts.add(createModuleScriptElement(script));
30
+ }
31
+ }
32
+ return { links, styles, scripts };
33
+ }
34
+ componentMetadata() {
35
+ }
36
+ }
37
+ export {
38
+ AppPipeline
39
+ };
@@ -0,0 +1,59 @@
1
+ import type { MiddlewareHandler, RouteData, RuntimeMode, SSRLoadedRenderer, SSRManifest, SSRResult } from '../@types/astro.js';
2
+ import type { Logger } from './logger/core.js';
3
+ import { RouteCache } from './render/route-cache.js';
4
+ /**
5
+ * The `Pipeline` represents the static parts of rendering that do not change between requests.
6
+ * These are mostly known when the server first starts up and do not change.
7
+ *
8
+ * Thus, a `Pipeline` is created once at process start and then used by every `RenderContext`.
9
+ */
10
+ export declare abstract class Pipeline {
11
+ readonly logger: Logger;
12
+ readonly manifest: SSRManifest;
13
+ /**
14
+ * "development" or "production"
15
+ */
16
+ readonly mode: RuntimeMode;
17
+ readonly renderers: SSRLoadedRenderer[];
18
+ readonly resolve: (s: string) => Promise<string>;
19
+ /**
20
+ * Based on Astro config's `output` option, `true` if "server" or "hybrid".
21
+ */
22
+ readonly serverLike: boolean;
23
+ readonly streaming: boolean;
24
+ /**
25
+ * Used to provide better error messages for `Astro.clientAddress`
26
+ */
27
+ readonly adapterName: string;
28
+ readonly clientDirectives: Map<string, string>;
29
+ readonly compressHTML: boolean;
30
+ readonly i18n: import("./app/types.js").SSRManifestI18n | undefined;
31
+ readonly middleware: MiddlewareHandler;
32
+ readonly routeCache: RouteCache;
33
+ /**
34
+ * Used for `Astro.site`.
35
+ */
36
+ readonly site: string | undefined;
37
+ readonly internalMiddleware: MiddlewareHandler[];
38
+ constructor(logger: Logger, manifest: SSRManifest,
39
+ /**
40
+ * "development" or "production"
41
+ */
42
+ mode: RuntimeMode, renderers: SSRLoadedRenderer[], resolve: (s: string) => Promise<string>,
43
+ /**
44
+ * Based on Astro config's `output` option, `true` if "server" or "hybrid".
45
+ */
46
+ serverLike: boolean, streaming: boolean,
47
+ /**
48
+ * Used to provide better error messages for `Astro.clientAddress`
49
+ */
50
+ adapterName?: string, clientDirectives?: Map<string, string>, compressHTML?: boolean, i18n?: import("./app/types.js").SSRManifestI18n | undefined, middleware?: MiddlewareHandler, routeCache?: RouteCache,
51
+ /**
52
+ * Used for `Astro.site`.
53
+ */
54
+ site?: string | undefined);
55
+ abstract headElements(routeData: RouteData): Promise<HeadElements> | HeadElements;
56
+ abstract componentMetadata(routeData: RouteData): Promise<SSRResult['componentMetadata']> | void;
57
+ }
58
+ export interface HeadElements extends Pick<SSRResult, 'scripts' | 'styles' | 'links'> {
59
+ }
@@ -0,0 +1,27 @@
1
+ import { RouteCache } from "./render/route-cache.js";
2
+ import { createI18nMiddleware } from "../i18n/middleware.js";
3
+ class Pipeline {
4
+ constructor(logger, manifest, mode, renderers, resolve, serverLike, streaming, adapterName = manifest.adapterName, clientDirectives = manifest.clientDirectives, compressHTML = manifest.compressHTML, i18n = manifest.i18n, middleware = manifest.middleware, routeCache = new RouteCache(logger, mode), site = manifest.site) {
5
+ this.logger = logger;
6
+ this.manifest = manifest;
7
+ this.mode = mode;
8
+ this.renderers = renderers;
9
+ this.resolve = resolve;
10
+ this.serverLike = serverLike;
11
+ this.streaming = streaming;
12
+ this.adapterName = adapterName;
13
+ this.clientDirectives = clientDirectives;
14
+ this.compressHTML = compressHTML;
15
+ this.i18n = i18n;
16
+ this.middleware = middleware;
17
+ this.routeCache = routeCache;
18
+ this.site = site;
19
+ this.internalMiddleware = [
20
+ createI18nMiddleware(i18n, manifest.base, manifest.trailingSlash, manifest.buildFormat)
21
+ ];
22
+ }
23
+ internalMiddleware;
24
+ }
25
+ export {
26
+ Pipeline
27
+ };
@@ -4,4 +4,4 @@ import { type BuildInternals } from '../../core/build/internal.js';
4
4
  import type { StaticBuildOptions } from './types.js';
5
5
  export declare function rootRelativeFacadeId(facadeId: string, settings: AstroSettings): string;
6
6
  export declare function chunkIsPage(settings: AstroSettings, output: OutputAsset | OutputChunk, internals: BuildInternals): boolean;
7
- export declare function generatePages(opts: StaticBuildOptions, internals: BuildInternals): Promise<void>;
7
+ export declare function generatePages(options: StaticBuildOptions, internals: BuildInternals): Promise<void>;