before_code
stringlengths
14
465k
reviewer_comment
stringlengths
16
64.5k
after_code
stringlengths
9
467k
diff_context
stringlengths
0
97k
file_path
stringlengths
5
226
comment_line
int32
0
26
language
stringclasses
37 values
quality_score
float32
0.07
1
comment_type
stringclasses
9 values
comment_length
int32
16
64.5k
before_lines
int32
1
17.2k
after_lines
int32
1
12.1k
is_negative
bool
2 classes
pr_title
stringlengths
1
308
pr_number
int32
1
299k
repo_name
stringclasses
533 values
repo_stars
int64
321
419k
repo_language
stringclasses
27 values
reviewer_username
stringlengths
0
39
author_username
stringlengths
2
39
}); let environment = server.environments.ssr; const virtualMod = environment.moduleGraph.getModuleById(ASTRO_ROUTES_MODULE_ID_RESOLVED); if (!virtualMod) return; environment.moduleGraph.invalidateModule(virtualMod); } } return { name: 'astro:routes', configureServer(server) { server.watcher....
No issues found.
}); let environment = server.environments.ssr; const virtualMod = environment.moduleGraph.getModuleById(ASTRO_ROUTES_MODULE_ID_RESOLVED); if (!virtualMod) return; environment.moduleGraph.invalidateModule(virtualMod); } } return { name: 'astro:routes', configureServer(server) { server.watcher....
@@ -11,15 +11,15 @@ import { createRoutesList } from '../core/routing/index.js'; import { getRoutePrerenderOption } from '../core/routing/manifest/prerender.js'; import { isEndpoint, isPage } from '../core/util.js'; import { rootRelativePath } from '../core/viteUtils.js'; -import type { AstroSettings } from '../type...
packages/astro/src/vite-plugin-routes/index.ts
0
TypeScript
1
none
16
51
51
true
Get demo app deploying to Cloudflare
14,634
withastro/astro
47,179
TypeScript
matthewp
createActionAPIContext(): ActionAPIContext { const renderContext = this; const { params, pipeline, url } = this; return { // Don't allow reassignment of cookies because it doesn't work get cookies() { return renderContext.cookies; }, routePattern: this.routeData.route, isPrerendered: this.ro...
No issues found.
createActionAPIContext(): ActionAPIContext { const renderContext = this; const { params, pipeline, url } = this; return { // Don't allow reassignment of cookies because it doesn't work get cookies() { return renderContext.cookies; }, routePattern: this.routeData.route, isPrerendered: this.ro...
@@ -50,12 +50,12 @@ export type CreateRenderContext = Pick< Pick< RenderContext, | 'locals' - | 'middleware' | 'status' | 'props' | 'partial' | 'actions' | 'shouldInjectCspMetaTags' + | 'skipMiddleware' > >; @@ -78,6 +78,7 @@ export class RenderContext { public partial: unde...
packages/astro/src/core/render-context.ts
0
TypeScript
1
none
16
51
51
true
refactor(core): clean up of apps
14,637
withastro/astro
47,179
TypeScript
ematipico
root: './fixtures/i18n-routing-fallback-rewrite-filename/', }); await fixture.build(); }); it('should generate fallback files for pages with without locale-like filenames', async () => { let html = await fixture.readFile('/norway/index.html'); assert.equal(html.includes('Norway'), true); html =...
No issues found.
root: './fixtures/i18n-routing-fallback-rewrite-filename/', }); await fixture.build(); }); it('should generate fallback files for pages with without locale-like filenames', async () => { let html = await fixture.readFile('/norway/index.html'); assert.equal(html.includes('Norway'), true); html =...
@@ -1252,6 +1252,82 @@ describe('[SSG] i18n routing', () => { }); }); + describe('i18n routing with fallback rewrite with locale-like filenames', () => { + /** @type {import('./test-utils').Fixture} */ + let fixture; + + before(async () => { + fixture = await loadFixture({ + root: './fixtures/i18n-routin...
packages/astro/test/i18n-routing.test.js
0
JavaScript
1
none
16
51
51
true
fix(i18n): generate fallbacks for pages with filenames containing locale keys
14,690
withastro/astro
47,179
TypeScript
fredriknorlin
} catch (e: any) { // The server may be closed due to a restart caused by this file change if (e.code === 'ERR_CLOSED_SERVER') break; throw e; } } } } }); }, }, ]; if (settings.contentEntryTypes.some((t) => t.getRenderModule)) { plugins.push({ ...
No issues found.
} catch (e: any) { // The server may be closed due to a restart caused by this file change if (e.code === 'ERR_CLOSED_SERVER') break; throw e; } } } } }); }, }, ]; if (settings.contentEntryTypes.some((t) => t.getRenderModule)) { plugins.push({ ...
@@ -85,14 +85,6 @@ export function astroContentImportPlugin({ name: 'astro:content-imports', config(_config, env) { shouldEmitFile = env.command === 'build'; - return { - environments: { - content: { - // This is all that's needed to create a new RunnableDevEnvironment - dev: {}, - ...
packages/astro/src/content/vite-plugin-content-imports.ts
0
TypeScript
1
none
16
51
51
true
refactor: fonts
14,694
withastro/astro
47,179
TypeScript
ematipico
} declare global { // This is not a real global, but is injected using Vite define to allow us to specify the Images binding name in the config. var __ASTRO_IMAGES_BINDING_NAME: string; } export async function handle( request: Parameters<ExportedHandlerFetchHandler>[0], env: Env, context: ExecutionContext, ): Pr...
No issues found.
} declare global { // This is not a real global, but is injected using Vite define to allow us to specify the Images binding name in the config. var __ASTRO_IMAGES_BINDING_NAME: string; } export async function handle( request: Parameters<ExportedHandlerFetchHandler>[0], env: Env, context: ExecutionContext, ): Pr...
@@ -1,5 +1,6 @@ // @ts-expect-error - It is safe to expect the error here. import { env as globalEnv } from 'cloudflare:workers'; +import { sessionKVBindingName } from 'virtual:astro-cloudflare:config'; import type { Response as CfResponse, CacheStorage as CloudflareCacheStorage, @@ -27,14 +28,8 @@ export interf...
packages/integrations/cloudflare/src/utils/handler.ts
0
TypeScript
1
none
16
51
51
true
feat: full sessions support w/ environment api
14,696
withastro/astro
47,179
TypeScript
matthewp
import { expectTypeOf } from 'expect-type'; import { type ActionInputSchema, defineAction } from '../../dist/actions/runtime/server.js'; import { z } from '../../dist/zod.js'; describe('ActionInputSchema', () => { const acceptVariants = ['form', 'json', undefined] as const; for (const accept of acceptVariants) { ...
No issues found.
import { expectTypeOf } from 'expect-type'; import { type ActionInputSchema, defineAction } from '../../dist/actions/runtime/server.js'; import { z } from '../../dist/zod.js'; describe('ActionInputSchema', () => { const acceptVariants = ['form', 'json', undefined] as const; for (const accept of acceptVariants) { ...
@@ -0,0 +1,51 @@ +import { describe, it } from 'node:test'; +import { expectTypeOf } from 'expect-type'; +import { type ActionInputSchema, defineAction } from '../../dist/actions/runtime/server.js'; +import { z } from '../../dist/zod.js'; + +describe('ActionInputSchema', () => { + const acceptVariants = ['form', 'json'...
packages/astro/test/types/action-input-schema.ts
0
TypeScript
1
none
16
51
51
true
feat: Add `ActionInputSchema` utility type
14,698
withastro/astro
47,179
TypeScript
mauriciabad
return { code: `export default { experimentalReactChildren: ${JSON.stringify(experimentalReactChildren)}, experimentalDisableStreaming: ${JSON.stringify(experimentalDisableStreaming)} }`, }; } }, }; } function getViteConfiguration( { include, exclude, babel, experimentalRea...
No issues found.
return { code: `export default { experimentalReactChildren: ${JSON.stringify(experimentalReactChildren)}, experimentalDisableStreaming: ${JSON.stringify(experimentalDisableStreaming)} }`, }; } }, }; } function getViteConfiguration( { include, exclude, babel, experimentalRea...
@@ -1,11 +1,10 @@ import react, { type Options as ViteReactPluginOptions } from '@vitejs/plugin-react'; -import type { AstroIntegration, ContainerRenderer } from 'astro'; +import type { AstroIntegration, AstroRenderer } from 'astro'; import type * as vite from 'vite'; import { getReactMajorVersion, - isUnsupported...
packages/integrations/react/src/index.ts
0
TypeScript
1
none
16
51
51
true
feat: return `clientEntrypoint` from `getContainerRenderer`
14,715
withastro/astro
47,179
TypeScript
ascorbic
for (const file of files) { if (cancel()) { result.status = 'cancelled'; return result; } const fileDiagnostics = await this.linter.check(file); // Filter diagnostics based on the logErrors level const fileDiagnosticsToPrint = fileDiagnostics.filter((diag) => { const severity = diag.severi...
No issues found.
for (const file of files) { if (cancel()) { result.status = 'cancelled'; return result; } const fileDiagnostics = await this.linter.check(file); // Filter diagnostics based on the logErrors level const fileDiagnosticsToPrint = fileDiagnostics.filter((diag) => { const severity = diag.severi...
@@ -141,7 +141,7 @@ export class AstroCheck { getSvelteLanguagePlugin(), getVueLanguagePlugin(), ]; - const services = [...createTypeScriptServices(this.ts), createAstroService(this.ts)]; + const services = [...createTypeScriptServices(this.ts), createAstroService()]; if (tsconfigPath) { const inc...
packages/language-tools/language-server/src/check.ts
0
TypeScript
1
none
16
51
51
true
feat(language-server)!: remove support for Astro.glob()
14,720
withastro/astro
47,179
TypeScript
florian-lefebvre
}); describe('dev', () => { /** @type {import('./test-utils.js').DevServer} */ let devServer; before(async () => { devServer = await fixture.startDevServer(); }); after(async () => { await devServer.stop(); }); it('should not include Astro components in client bundles', async () => { const ...
No issues found.
}); describe('dev', () => { /** @type {import('./test-utils.js').DevServer} */ let devServer; before(async () => { devServer = await fixture.startDevServer(); }); after(async () => { await devServer.stop(); }); it('should not include Astro components in client bundles', async () => { const ...
@@ -1,21 +1,70 @@ import assert from 'node:assert/strict'; -import { before, describe, it } from 'node:test'; +import { after, before, describe, it } from 'node:test'; import { loadFixture } from './test-utils.js'; describe('Component bundling', () => { + /** @type {import('./test-utils.js').Fixture} */ let fixt...
packages/astro/test/astro-component-bundling.test.js
0
JavaScript
1
none
16
51
51
true
Stub out `.astro` imports in client modules
14,751
withastro/astro
47,179
TypeScript
delucis
import { defineCollection, z } from 'astro:content'; import { glob } from 'astro/loaders'; const blog = defineCollection({ loader: { name: 'test', load: async () => {}, schema: () => z.object() } }); export const collections = { blog, };
No issues found.
import { defineCollection, z } from 'astro:content'; import { glob } from 'astro/loaders'; const blog = defineCollection({ loader: { name: 'test', load: async () => {}, schema: () => z.object() } }); export const collections = { blog, };
@@ -0,0 +1,14 @@ +import { defineCollection, z } from 'astro:content'; +import { glob } from 'astro/loaders'; + +const blog = defineCollection({ + loader: { + name: 'test', + load: async () => {}, + schema: () => z.object() + } +}); + +export const collections = { + blog, +};
packages/astro/test/fixtures/content-layer-loader-schema-function/src/content.config.ts
0
TypeScript
1
none
16
15
15
true
feat: `loader.createSchema()`
14,759
withastro/astro
47,179
TypeScript
florian-lefebvre
it('returns false for null', () => { assert.equal(MarkdownError.is(null), false); }); it('returns false for undefined', () => { assert.equal(MarkdownError.is(undefined), false); }); }); describe('InternalError.is()', () => { it('returns true for InternalError instances', () => { const error = ne...
No issues found.
it('returns false for null', () => { assert.equal(MarkdownError.is(null), false); }); it('returns false for undefined', () => { assert.equal(MarkdownError.is(undefined), false); }); }); describe('InternalError.is()', () => { it('returns true for InternalError instances', () => { const error = ne...
@@ -0,0 +1,229 @@ +import * as assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; +import { + AggregateError, + AstroError, + AstroUserError, + CompilerError, + CSSError, + InternalError, + isAstroError, + MarkdownError, +} from '../../../dist/core/errors/errors.js'; + +describe('Error type ch...
packages/astro/test/units/errors/errors.test.js
0
JavaScript
1
none
16
51
51
true
fix(errors): add type check to error
14,769
withastro/astro
47,179
TypeScript
adriandlam
for (const file of clientStatics) { internals.staticFiles.add(file); } const staticFiles = internals.staticFiles; const encodedKey = await encodeKey(await buildOpts.key); const manifest = await buildManifest(buildOpts, internals, Array.from(staticFiles), encodedKey); return manifest; } /** * It injects the m...
No issues found.
for (const file of clientStatics) { internals.staticFiles.add(file); } const staticFiles = internals.staticFiles; const encodedKey = await encodeKey(await buildOpts.key); const manifest = await buildManifest(buildOpts, internals, Array.from(staticFiles), encodedKey); return manifest; } /** * It injects the m...
@@ -75,7 +75,7 @@ export async function manifestBuildPostHook( }, ) { const manifest = await createManifest(options, internals); - + if(ssrOutputs.length > 0) { let manifestEntryChunk: OutputChunk | undefined; @@ -153,7 +153,8 @@ async function createManifest( const staticFiles = internals.staticFiles;...
packages/astro/src/core/build/plugins/plugin-manifest.ts
0
TypeScript
1
none
16
51
51
true
fix: resolve environment-api build issues for client & CSS
14,770
withastro/astro
47,179
TypeScript
matthewp
describe('build', () => { let $; before(async () => { fixture = await loadFixture({ root: './fixtures/passthrough-image-service/', }); await fixture.build(); const html = await fixture.readFile('/index.html'); $ = cheerio.load(html); }); describe('Assets', () => { it('does not generat...
No issues found.
describe('build', () => { let $; before(async () => { fixture = await loadFixture({ root: './fixtures/passthrough-image-service/', }); await fixture.build(); const html = await fixture.readFile('/index.html'); $ = cheerio.load(html); }); describe('Assets', () => { it('does not generat...
@@ -0,0 +1,67 @@ +import assert from 'node:assert/strict'; +import { before, describe, it } from 'node:test'; +import * as cheerio from 'cheerio'; +import { loadFixture } from './test-utils.js'; + +describe('passthroughImageService', () => { + /** @type {import('./test-utils.js').Fixture} */ + let fixture; + + describe...
packages/astro/test/passthrough-image-service.test.js
0
JavaScript
1
none
16
51
51
true
fix: `passthroughImageService` generate webp
14,776
withastro/astro
47,179
TypeScript
ktym4a
}, }); const storage = createFsStorage({ base: cacheDir }); const systemFallbacksProvider = createSystemFallbacksProvider(); fontFetcher = createCachedFontFetcher({ storage, errorHandler, fetch, readFile }); const fontMetricsResolver = createCapsizeFontMetricsResolver({ fontFetcher, cssRenderer }); fontT...
No issues found.
}, }); const storage = createFsStorage({ base: cacheDir }); const systemFallbacksProvider = createSystemFallbacksProvider(); fontFetcher = createCachedFontFetcher({ storage, errorHandler, fetch, readFile }); const fontMetricsResolver = createCapsizeFontMetricsResolver({ fontFetcher, cssRenderer }); fontT...
@@ -67,7 +67,7 @@ interface Options { } export function fontsPlugin({ settings, sync, logger }: Options): Plugin { - if (sync || !settings.config.experimental.fonts) { + if (!settings.config.experimental.fonts) { // This is required because the virtual module may be imported as // a side effect // TODO: re...
packages/astro/src/assets/fonts/vite-plugin-fonts.ts
0
TypeScript
1
none
16
51
51
true
fix: sync override settings
14,782
withastro/astro
47,179
TypeScript
florian-lefebvre
.reduce(mergeInlineCss, []); const styles = createStylesheetElementSet(sortedCssAssets ?? [], base, assetsPrefix); if (settings.scripts.some((script) => script.stage === 'page')) { const hashedFilePath = internals.entrySpecifierToBundleMap.get(PAGE_SCRIPT_ID); if (typeof hashedFilePath !== 'string') { ...
No issues found.
.reduce(mergeInlineCss, []); const styles = createStylesheetElementSet(sortedCssAssets ?? [], base, assetsPrefix); if (settings.scripts.some((script) => script.stage === 'page')) { const hashedFilePath = internals.entrySpecifierToBundleMap.get(PAGE_SCRIPT_ID); if (typeof hashedFilePath !== 'string') { ...
@@ -1,11 +1,10 @@ import type { ComponentInstance } from '../../types/astro.js'; import type { RewritePayload } from '../../types/public/common.js'; -import type { - RouteData, - SSRElement, - SSRResult, -} from '../../types/public/internal.js'; -import { VIRTUAL_PAGE_MODULE_ID, VIRTUAL_PAGE_RESOLVED_MODULE_ID } from...
packages/astro/src/core/build/pipeline.ts
0
TypeScript
1
none
16
51
51
true
fix: flag `serverLike` incorrectly computed
14,792
withastro/astro
47,179
TypeScript
ematipico
const res = await fixture.fetch('/blog/2022/post-2'); assert.equal(res.status, 200); }); }); it('provides routePattern', async () => { const res = await fixture.fetch('/blog/2022/post-1'); assert.equal(res.status, 200); const html = await res.text(); const $ = cheerio.load(html); assert.equal($('...
No issues found.
const res = await fixture.fetch('/blog/2022/post-2'); assert.equal(res.status, 200); }); }); it('provides routePattern', async () => { const res = await fixture.fetch('/blog/2022/post-1'); assert.equal(res.status, 200); const html = await res.text(); const $ = cheerio.load(html); assert.equal($('...
@@ -6,13 +6,25 @@ import { loadFixture } from './test-utils.js'; const root = new URL('./fixtures/astro-get-static-paths/', import.meta.url); +const paramsTypePlugin = (type = 'string') => ({ + name: 'vite-plugin-param-type', + resolveId(name) { + if(name ==='virtual:my:param:type') { + return '\0virtual:my:pa...
packages/astro/test/astro-get-static-paths.test.js
0
JavaScript
1
none
16
51
51
true
Use routeCache from the pipeline
14,794
withastro/astro
47,179
TypeScript
matthewp
*/ optimizedFallbacks: z.boolean().optional(), }); const requiredFamilyAttributesSchema = z.object({ /** * The font family name, as identified by your font provider. */ name: z.string(), /** * A valid [ident](https://developer.mozilla.org/en-US/docs/Web/CSS/ident) in the form of a CSS variable (i.e. starti...
No issues found.
*/ optimizedFallbacks: z.boolean().optional(), }); const requiredFamilyAttributesSchema = z.object({ /** * The font family name, as identified by your font provider. */ name: z.string(), /** * A valid [ident](https://developer.mozilla.org/en-US/docs/Web/CSS/ident) in the form of a CSS variable (i.e. starti...
@@ -164,7 +164,7 @@ export const remoteFontFamilySchema = requiredFamilyAttributesSchema */ styles: z.array(styleSchema).nonempty().optional(), /** - * @default `["cyrillic-ext", "cyrillic", "greek-ext", "greek", "vietnamese", "latin-ext", "latin"]` + * @default `["latin"]` * * An array of ...
packages/astro/src/assets/fonts/config.ts
0
TypeScript
1
none
16
51
51
true
feat(fonts)!: update default subsets
14,796
withastro/astro
47,179
TypeScript
florian-lefebvre
app: BaseApp, pipeline: BuildPipeline, builtPaths: Set<string>, ): Promise<Array<string>> { const { options, manifest } = pipeline; const logger = app.logger; // TODO: investigate if BuildPipeline can be removed. We already have app.pipeline // which contains routeCache and other pipeline data. Eventually all pi...
No issues found.
app: BaseApp, pipeline: BuildPipeline, builtPaths: Set<string>, ): Promise<Array<string>> { const { options, manifest } = pipeline; const logger = app.logger; // TODO: investigate if BuildPipeline can be removed. We already have app.pipeline // which contains routeCache and other pipeline data. Eventually all pi...
@@ -58,7 +58,10 @@ export async function generatePages( // Grab the manifest and create the pipeline const manifest: SSRManifest = prerenderEntry.manifest; const pipeline = BuildPipeline.create({ internals, manifest, options }); - const { config, logger } = pipeline; + const app = prerenderEntry.app as BaseApp; +...
packages/astro/src/core/build/generate.ts
0
TypeScript
1
none
16
51
51
true
fix: logger level and static paths params
14,799
withastro/astro
47,179
TypeScript
ematipico
} /** * This plugin tracks the CSS that should be applied by route. * * The virtual module should be used only during development. * Per-route virtual modules are created to avoid invalidation loops. * * @param routesList */ export function astroDevCssPlugin({ routesList, command }: AstroVitePluginOptions): Plu...
No issues found.
} /** * This plugin tracks the CSS that should be applied by route. * * The virtual module should be used only during development. * Per-route virtual modules are created to avoid invalidation loops. * * @param routesList */ export function astroDevCssPlugin({ routesList, command }: AstroVitePluginOptions): Plu...
@@ -1,7 +1,6 @@ import type { Plugin, RunnableDevEnvironment } from 'vite'; import { wrapId } from '../core/util.js'; import type { ImportedDevStyle, RoutesList } from '../types/astro.js'; -import type { RouteData } from '../types/public/index.js'; import { isBuildableCSSRequest } from '../vite-plugin-astro-server/...
packages/astro/src/vite-plugin-css/index.ts
0
TypeScript
1
none
16
51
51
true
Fix image tests crashing
14,803
withastro/astro
47,179
TypeScript
matthewp
import('./info/core/get-package-manager.js'), import('./info/infra/styled-debug-info-formatter.js'), import('./info/infra/prompts-prompt.js'), import('./info/infra/cli-clipboard.js'), import('./infra/passthrough-text-styler.js'), import('./info/core/info.js'), ]); const operatingSystemProv...
No issues found.
import('./info/core/get-package-manager.js'), import('./info/infra/styled-debug-info-formatter.js'), import('./info/infra/prompts-prompt.js'), import('./info/infra/cli-clipboard.js'), import('./infra/passthrough-text-styler.js'), import('./info/core/info.js'), ]); const operatingSystemProv...
@@ -56,19 +56,19 @@ async function runCommand(cmd: string, flags: yargs.Arguments) { const [ { createLoggerFromFlags }, - { createPicocolorsTextStyler }, + { createPiccoloreTextStyler }, { createBuildTimeAstroVersionProvider }, { createLoggerHelpDisplay }, { createCliCommandRunner }, ] = await Promi...
packages/astro/src/cli/index.ts
0
TypeScript
1
none
16
51
51
true
fix: remove picocolors
14,813
withastro/astro
47,179
TypeScript
ematipico
import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.js'; /** * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture */ export async function loadFixture(inlineConfig) { if (!inlineConfig?.root) throw new Error("Must provide { root: './fixtures/...' }"); // resolve the rel...
No issues found.
import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.js'; /** * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture */ export async function loadFixture(inlineConfig) { if (!inlineConfig?.root) throw new Error("Must provide { root: './fixtures/...' }"); // resolve the rel...
@@ -3,13 +3,36 @@ import { loadFixture as baseLoadFixture } from '../../../astro/test/test-utils.j /** * @typedef {import('../../../astro/test/test-utils').Fixture} Fixture */ -export function loadFixture(inlineConfig) { +export async function loadFixture(inlineConfig) { if (!inlineConfig?.root) throw new Error(...
packages/integrations/cloudflare/test/_test-utils.js
0
JavaScript
1
none
16
39
39
true
fix(deps): update `@sveltejs/vite-plugin-svelte` to v6
14,821
withastro/astro
47,179
TypeScript
ocavue
}), }); const relevantLogs = logs .filter((log) => log.level === 'warn' && log.label === 'build') .map((log) => log.message); assert.deepEqual( relevantLogs, [ 'Could not render `/c` from route `/[foo]` as it conflicts with higher priority route `/[bar]`.', ], 'Should warn ab...
No issues found.
}), }); const relevantLogs = logs .filter((log) => log.level === 'warn' && log.label === 'build') .map((log) => log.message); assert.deepEqual( relevantLogs, [ 'Could not render `/c` from route `/[foo]` as it conflicts with higher priority route `/[bar]`.', ], 'Should warn ab...
@@ -5,7 +5,7 @@ import { loadFixture } from './test-utils.js'; /** * Dynamic vs dynamic duplication should warn by default and succeed. - * When experimental.failOnPrerenderConflict is true, it should fail. + * When prerenderConflictBehavior is set to 'error', it should fail. * Static vs dynamic should also warn...
packages/astro/test/prerender-conflict.test.js
0
JavaScript
1
none
16
51
51
true
feat(astro)!: stabilize failOnPrerenderConflict
14,826
withastro/astro
47,179
TypeScript
florian-lefebvre
build: { outDir: fileURLToPath(getServerOutputDirectory(settings)), rollupOptions: { output: { ...viteConfig.environments?.ssr?.build?.rollupOptions?.output } } }, }, }, }; const updatedViteBuildConfig = await runHookBuildSetup({ config: settings.config, pages: inte...
No issues found.
build: { outDir: fileURLToPath(getServerOutputDirectory(settings)), rollupOptions: { output: { ...viteConfig.environments?.ssr?.build?.rollupOptions?.output } } }, }, }, }; const updatedViteBuildConfig = await runHookBuildSetup({ config: settings.config, pages: inte...
@@ -26,6 +26,7 @@ import { RESOLVED_SSR_VIRTUAL_MODULE_ID } from './plugins/plugin-ssr.js'; import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js'; import type { StaticBuildOptions } from './types.js'; import { encodeName, getTimeStat, viteBuildReturnToRollupOutputs } from './util.js'; +import { NOOP_...
packages/astro/src/core/build/static-build.ts
0
TypeScript
1
none
16
51
51
true
Fixes assetQueryParams and public folder tests
14,853
withastro/astro
47,179
TypeScript
matthewp
* * The virtual module should be used only during development. * Per-route virtual modules are created to avoid invalidation loops. * * The second plugin imports all of the individual CSS modules in a map. * * @param routesList */ export function astroDevCssPlugin({ routesList, command }: AstroVitePluginOptions...
No issues found.
* * The virtual module should be used only during development. * Per-route virtual modules are created to avoid invalidation loops. * * The second plugin imports all of the individual CSS modules in a map. * * @param routesList */ export function astroDevCssPlugin({ routesList, command }: AstroVitePluginOptions...
@@ -5,6 +5,7 @@ import type * as vite from 'vite'; import { isBuildableCSSRequest } from '../vite-plugin-astro-server/util.js'; import { getVirtualModulePageNameForComponent } from '../vite-plugin-pages/util.js'; import { getDevCSSModuleName } from './util.js'; +import { prependForwardSlash } from '@astrojs/internal...
packages/astro/src/vite-plugin-css/index.ts
0
TypeScript
1
none
16
51
51
true
Fixes for e2e tests in environment branch
14,870
withastro/astro
47,179
TypeScript
matthewp
* ```js * // astro.config.mjs * * export default defineConfig({ * i18n: { * locales: [ * { codes: ["it-VT", "it"], path: "italiano" }, * "es" * ] * } * }) * ``` * * Here's some use cases: * * ```js * import { pathHasLocale } from "astro:i18n"; * pathHasLocale("italiano"); // returns `true`...
No issues found.
* ```js * // astro.config.mjs * * export default defineConfig({ * i18n: { * locales: [ * { codes: ["it-VT", "it"], path: "italiano" }, * "es" * ] * } * }) * ``` * * Here's some use cases: * * ```js * import { pathHasLocale } from "astro:i18n"; * pathHasLocale("italiano"); // returns `true`...
@@ -3,7 +3,10 @@ import * as config from 'astro:config/server'; import { toFallbackType } from '../core/app/common.js'; import { toRoutingStrategy } from '../core/app/index.js'; import type { SSRManifest } from '../core/app/types.js'; -import { IncorrectStrategyForI18n } from '../core/errors/errors-data.js'; +import...
packages/astro/src/virtual-modules/i18n.ts
0
TypeScript
1
none
16
51
51
true
fix: i18n middleware impossible config
14,890
withastro/astro
47,179
TypeScript
florian-lefebvre
let devServer; before(async () => { fixture = await loadFixture({ root: './fixtures/astro-dev-platform/', logLevel: 'debug', }); devServer = await fixture.startDevServer(); // Do an initial request to prime preloading await fixture.fetch('/'); }); after(async () => { await devServer.stop(); }); ...
No issues found.
let devServer; before(async () => { fixture = await loadFixture({ root: './fixtures/astro-dev-platform/', logLevel: 'debug', }); devServer = await fixture.startDevServer(); // Do an initial request to prime preloading await fixture.fetch('/'); }); after(async () => { await devServer.stop(); }); ...
@@ -12,19 +12,14 @@ describe('AstroDevPlatform', () => { logLevel: 'debug', }); devServer = await fixture.startDevServer(); + // Do an initial request to prime preloading + await fixture.fetch('/'); }); after(async () => { await devServer.stop(); }); - it('exists', async () => { - const res = ...
packages/integrations/cloudflare/test/astro-dev-platform.test.js
0
JavaScript
1
none
16
51
51
true
Fix remaining cloudflare tests
14,912
withastro/astro
47,179
TypeScript
matthewp
it('client', async () => { const res = await fixture.fetch('/'); const html = await res.text(); const $ = cheerio.load(html); assert.equal($('#client').text().includes('https://google.de'), true); }); it('server', async () => { const res = await fixture.fetch('/'); const html = await r...
No issues found.
it('client', async () => { const res = await fixture.fetch('/'); const html = await res.text(); const $ = cheerio.load(html); assert.equal($('#client').text().includes('https://google.de'), true); }); it('server', async () => { const res = await fixture.fetch('/'); const html = await r...
@@ -5,21 +5,27 @@ import { loadFixture } from './_test-utils.js'; describe( 'astro:env', - { todo: 'Make secrets work again', skip: 'At the moment, private secrets are broken' }, () => { describe('ssr', () => { let fixture; + let previewServer; + before(async () => { process.env.API_URL = 'http...
packages/integrations/cloudflare/test/astro-env.test.js
0
JavaScript
1
none
16
51
51
true
Fix astro:env tests in Cloudflare
14,925
withastro/astro
47,179
TypeScript
matthewp
if (part.startsWith('_')) return true; } return false; } function getYAMLErrorLine(rawData: string | undefined, objectKey: string) { if (!rawData) return 0; const indexOfObjectKey = rawData.search( // Match key either at the top of the file or after a newline // Ensures matching on top-level object keys only...
No issues found.
if (part.startsWith('_')) return true; } return false; } function getYAMLErrorLine(rawData: string | undefined, objectKey: string) { if (!rawData) return 0; const indexOfObjectKey = rawData.search( // Match key either at the top of the file or after a newline // Ensures matching on top-level object keys only...
@@ -11,6 +11,7 @@ import * as z from 'zod/v4'; import { AstroError, AstroErrorData, errorMap, MarkdownError } from '../core/errors/index.js'; import { isYAMLException } from '../core/errors/utils.js'; import type { Logger } from '../core/logger/core.js'; +import { appendForwardSlash } from '../core/path.js'; import...
packages/astro/src/content/utils.ts
0
TypeScript
1
none
16
51
51
true
feat: add legacy.collectionsBackwardsCompat flag for v6 content colle…
14,927
withastro/astro
47,179
TypeScript
matthewp
app = await fixture.loadTestAdapterApp(); }); it('should render locals data', async () => { const request = new Request('http://example.com/'); const response = await app.render(request); const html = await response.text(); const $ = cheerio.load(html); assert.equal($('p').html(), 'bar'); }); it('shou...
No issues found.
app = await fixture.loadTestAdapterApp(); }); it('should render locals data', async () => { const request = new Request('http://example.com/'); const response = await app.render(request); const html = await response.text(); const $ = cheerio.load(html); assert.equal($('p').html(), 'bar'); }); it('shou...
@@ -112,6 +112,21 @@ describe('Middleware in DEV mode', () => { assert.equal(res.status, 302); assert.equal(res.headers.get('location'), '/'); }); + + it('should reject double-encoded paths with 404', async () => { + const res = await fixture.fetch('/%2561dmin', { redirect: 'manual' }); + assert.equal(r...
packages/astro/test/middleware.test.js
0
JavaScript
1
none
16
51
51
true
fix: prevent authentication bypass via double URL encoding in middleware
14,929
withastro/astro
47,179
TypeScript
matthewp
import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { fileURLToPath } from 'node:url'; import { cli } from '../../../astro/test/test-utils.js'; describe('Svelte Check', () => { it('should fail check on type error', async () => { const root = fileURLToPath(new URL('./fixtures/pr...
No issues found.
import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { fileURLToPath } from 'node:url'; import { cli } from '../../../astro/test/test-utils.js'; describe('Svelte Check', () => { it('should fail check on type error', async () => { const root = fileURLToPath(new URL('./fixtures/pr...
@@ -0,0 +1,18 @@ +import assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; +import { fileURLToPath } from 'node:url'; +import { cli } from '../../../astro/test/test-utils.js'; + +describe('Svelte Check', () => { + it('should fail check on type error', async () => { + const root = fileURLToPa...
packages/integrations/svelte/test/check.test.js
0
JavaScript
1
none
16
19
19
true
fix: svelte 5 prop types
14,934
withastro/astro
47,179
TypeScript
antonyfaris
// @ts-check import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { deduplicateDirectiveValues, pushDirective, } from '../../../dist/core/csp/runtime.js'; describe('deduplicateDirectiveValues', () => { it('merges directives', () => { let result = deduplicateDirectiveValues("im...
No issues found.
// @ts-check import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { deduplicateDirectiveValues, pushDirective, } from '../../../dist/core/csp/runtime.js'; describe('deduplicateDirectiveValues', () => { it('merges directives', () => { let result = deduplicateDirectiveValues("im...
@@ -0,0 +1,50 @@ +// @ts-check +import assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; +import { + deduplicateDirectiveValues, + pushDirective, +} from '../../../dist/core/csp/runtime.js'; + +describe('deduplicateDirectiveValues', () => { + it('merges directives', () => { + let result = de...
packages/astro/test/units/csp/runtime.test.js
0
JavaScript
1
none
16
51
51
true
fix(csp): deduplicate CSP resources
14,940
withastro/astro
47,179
TypeScript
ematipico
it('errors if a domains value is not an URL', async () => { const configError = await validateConfig({ output: 'server', site: 'https://www.example.com', i18n: { defaultLocale: 'en', locales: ['es', 'en'], domains: { en: 'www.example.com', }, }, }).catch((err) => err); ...
No issues found.
it('errors if a domains value is not an URL', async () => { const configError = await validateConfig({ output: 'server', site: 'https://www.example.com', i18n: { defaultLocale: 'en', locales: ['es', 'en'], domains: { en: 'www.example.com', }, }, }).catch((err) => err); ...
@@ -90,6 +90,15 @@ describe('Config Validation', () => { ); }); + it('errors with helpful message when output is "hybrid"', async () => { + const configError = await validateConfig({ output: 'hybrid' }).catch((err) => err); + assert.equal(configError instanceof z.ZodError, true); + assert.ok( + configError....
packages/astro/test/units/config/config-validate.test.js
0
JavaScript
1
none
16
51
51
true
feat: print a more helpful error message for `output: hybrid`
14,958
withastro/astro
47,179
TypeScript
ascorbic
appendCSSToPage(pageData, meta, pagesToCss, -1, order); } } } } } } }, }; const singleCssPlugin: VitePlugin = { name: 'astro:rollup-plugin-single-css', enforce: 'post', applyToEnvironment(environment) { return ( environment.name === ASTRO_VITE_ENVIRONMENT_NAME...
No issues found.
appendCSSToPage(pageData, meta, pagesToCss, -1, order); } } } } } } }, }; const singleCssPlugin: VitePlugin = { name: 'astro:rollup-plugin-single-css', enforce: 'post', applyToEnvironment(environment) { return ( environment.name === ASTRO_VITE_ENVIRONMENT_NAME...
@@ -11,13 +11,11 @@ import type { BuildInternals } from '../internal.js'; import { getPageDataByViteID, getPageDatasByClientOnlyID } from '../internal.js'; import type { PageBuildData, StaticBuildOptions, StylesheetAsset } from '../types.js'; import { shouldInlineAsset } from './util.js'; +import { ASTRO_VITE_ENVIRO...
packages/astro/src/core/build/plugins/plugin-css.ts
0
TypeScript
1
none
16
51
51
true
refactor: stabilise environment names
14,961
withastro/astro
47,179
TypeScript
ematipico
import assert from 'node:assert/strict'; import { Writable } from 'node:stream'; import { before, describe, it } from 'node:test'; import { Logger } from '../dist/core/logger/core.js'; import { loadFixture } from './test-utils.js'; describe('Public', () => { let fixture; let buildLogs = []; before(async () => { ...
No issues found.
import assert from 'node:assert/strict'; import { Writable } from 'node:stream'; import { before, describe, it } from 'node:test'; import { Logger } from '../dist/core/logger/core.js'; import { loadFixture } from './test-utils.js'; describe('Public', () => { let fixture; let buildLogs = []; before(async () => { ...
@@ -1,13 +1,30 @@ import assert from 'node:assert/strict'; +import { Writable } from 'node:stream'; import { before, describe, it } from 'node:test'; +import { Logger } from '../dist/core/logger/core.js'; import { loadFixture } from './test-utils.js'; describe('Public', () => { let fixture; + let buildLogs = []...
packages/astro/test/astro-public.test.js
0
JavaScript
1
none
16
48
48
true
fix: suppress empty chunk warning for noop entrypoint
14,976
withastro/astro
47,179
TypeScript
matthewp
let res = await customEndpointFixture.fetch(src); assert.equal(res.status, 200); assert.equal( await res.text(), "You fool! I'm not a image endpoint at all, I just return this!", ); }); after(async () => { await customEndpointDevServer.stop(); }); }); }); describe('proper e...
No issues found.
let res = await customEndpointFixture.fetch(src); assert.equal(res.status, 200); assert.equal( await res.text(), "You fool! I'm not a image endpoint at all, I just return this!", ); }); after(async () => { await customEndpointDevServer.stop(); }); }); }); describe('proper e...
@@ -164,6 +164,12 @@ describe('astro:image', () => { }), true, ); + + // Verify that the images can be fetched successfully + for (const img of $img.toArray()) { + const imgRes = await fixture.fetch(img.attribs['src']); + assert.equal(imgRes.status, 200); + } }); it('supports...
packages/astro/test/core-image.test.js
0
JavaScript
1
none
16
51
51
true
fix(assets): support images outside of the project in dev
14,982
withastro/astro
47,179
TypeScript
Princesseuh
client: new URL(`.${wrapWithSlashes(config.base)}`, config.outDir), server: new URL('./_worker.js/', config.outDir), serverEntry: 'index.js', redirects: false, }, session, vite: { plugins: [ cfVitePlugin(cfPluginConfig), // https://developers.cloudflare.com/pag...
No issues found.
client: new URL(`.${wrapWithSlashes(config.base)}`, config.outDir), server: new URL('./_worker.js/', config.outDir), serverEntry: 'index.js', redirects: false, }, session, vite: { plugins: [ cfVitePlugin(cfPluginConfig), // https://developers.cloudflare.com/pag...
@@ -1,8 +1,8 @@ -import { createReadStream, writeFileSync, copyFileSync, existsSync, readFileSync } from 'node:fs'; +import { createReadStream, copyFileSync, existsSync, readFileSync } from 'node:fs'; import { appendFile, stat } from 'node:fs/promises'; import { createRequire } from 'node:module'; import { createInt...
packages/integrations/cloudflare/src/index.ts
0
TypeScript
1
none
16
51
51
true
feat(cloudflare): inline config injection
14,984
withastro/astro
47,179
TypeScript
ematipico
if (baseUrl) { aliases.push({ find: /^(?!\.*\/|\.*$|\w:)(.+)$/, replacement: `${[...normalizePath(resolvedBaseUrl)] .map((segment) => (segment === '$' ? '$$' : segment)) .join('')}/$1`, }); } return aliases; }; /** Generate vite.resolve.alias entries from tsconfig paths */ const getViteResolveAli...
No issues found.
if (baseUrl) { aliases.push({ find: /^(?!\.*\/|\.*$|\w:)(.+)$/, replacement: `${[...normalizePath(resolvedBaseUrl)] .map((segment) => (segment === '$' ? '$$' : segment)) .join('')}/$1`, }); } return aliases; }; /** Generate vite.resolve.alias entries from tsconfig paths */ const getViteResolveAli...
@@ -1,7 +1,7 @@ import fs from 'node:fs'; import path from 'node:path'; import type { CompilerOptions } from 'typescript'; -import { normalizePath, type ResolvedConfig, type Plugin as VitePlugin } from 'vite'; +import { normalizePath, type Plugin as VitePlugin } from 'vite'; import type { AstroSettings } from '.....
packages/astro/src/vite-plugin-config-alias/index.ts
0
TypeScript
1
none
16
51
51
true
chore: address some TODO
14,986
withastro/astro
47,179
TypeScript
ematipico
import type { Environment } from 'vite'; import { ASTRO_VITE_ENVIRONMENT_NAMES } from './core/constants.js'; export function isAstroServerEnvironment(environment: Environment) { return ( environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender ); } exp...
No issues found.
import type { Environment } from 'vite'; import { ASTRO_VITE_ENVIRONMENT_NAMES } from './core/constants.js'; export function isAstroServerEnvironment(environment: Environment) { return ( environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender ); } exp...
@@ -0,0 +1,13 @@ +import type { Environment } from 'vite'; +import { ASTRO_VITE_ENVIRONMENT_NAMES } from './core/constants.js'; + +export function isAstroServerEnvironment(environment: Environment) { + return ( + environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr || + environment.name === ASTRO_VITE_ENVIRONMENT_NA...
packages/astro/src/environments.ts
0
TypeScript
1
none
16
14
14
true
chore: optimise the use of `opts.ssr`
15,001
withastro/astro
47,179
TypeScript
ematipico
}); it('errors if a domain is a URL with a pathname that is not the home', async () => { const configError = await validateConfig({ output: 'server', site: 'https://www.example.com', i18n: { defaultLocale: 'en', locales: ['es', 'en'], domains: { en: 'https://www.example.com/blog...
No issues found.
}); it('errors if a domain is a URL with a pathname that is not the home', async () => { const configError = await validateConfig({ output: 'server', site: 'https://www.example.com', i18n: { defaultLocale: 'en', locales: ['es', 'en'], domains: { en: 'https://www.example.com/blog...
@@ -589,4 +589,29 @@ describe('Config Validation', () => { ); }); }); + + describe('devToolbar', () => { + it('should allow valid placement values', async () => { + for (const placement of ['bottom-left', 'bottom-center', 'bottom-right']) { + const result = await validateConfig({ + devToolbar: { plac...
packages/astro/test/units/config/config-validate.test.js
0
JavaScript
1
none
16
51
51
true
Add `devToolbar.placement` configuration option
15,015
withastro/astro
47,179
TypeScript
tony
}); it('loads images with relative paths in JSON', async () => { assert.ok(json.rockets[1].data.image.src.startsWith('/_astro')); assert.equal(json.rockets[1].data.image.format, 'jpg'); }); it('renders images from frontmatter', async () => { assert.ok($('img[alt="Lunar Module"]').attr('src').startsWi...
No issues found.
}); it('loads images with relative paths in JSON', async () => { assert.ok(json.rockets[1].data.image.src.startsWith('/_astro')); assert.equal(json.rockets[1].data.image.format, 'jpg'); }); it('renders images from frontmatter', async () => { assert.ok($('img[alt="Lunar Module"]').attr('src').startsWi...
@@ -106,6 +106,26 @@ describe('Content Layer', () => { ); }); + it('retains body by default in glob() loader', async () => { + assert.ok(json.hasOwnProperty('spacecraftWithBody')); + assert.ok(Array.isArray(json.spacecraftWithBody)); + // All entries should have non-empty body + const columbia = json....
packages/astro/test/content-layer.test.js
0
JavaScript
1
none
16
51
51
true
feat: add `retainBody` option to the `glob()` loader
15,022
withastro/astro
47,179
TypeScript
ascorbic
// See plugin-manifest.ts for full architecture explanation manifestData = `'${MANIFEST_REPLACE}'`; } else { const serialized = await createSerializedManifest(settings); manifestData = JSON.stringify(serialized); } const code = ` import { deserializeManifest as _deserializeManifest ...
No issues found.
// See plugin-manifest.ts for full architecture explanation manifestData = `'${MANIFEST_REPLACE}'`; } else { const serialized = await createSerializedManifest(settings); manifestData = JSON.stringify(serialized); } const code = ` import { deserializeManifest as _deserializeManifest ...
@@ -23,6 +23,7 @@ import { VIRTUAL_PAGES_MODULE_ID } from '../vite-plugin-pages/index.js'; import { ASTRO_RENDERERS_MODULE_ID } from '../vite-plugin-renderers/index.js'; import { ASTRO_ROUTES_MODULE_ID } from '../vite-plugin-routes/index.js'; +// This is used by Cloudflare optimizeDeps config export const SERIALIZ...
packages/astro/src/manifest/serialized.ts
0
TypeScript
1
none
16
51
51
true
Add more optimizeDeps for Cloudflare prebundling
15,026
withastro/astro
47,179
TypeScript
matthewp
setTimeout( async () => loader.webSocketSend(await getViteErrorPayload(errorWithMetadata)), 200, ); } process.on('unhandledRejection', handleUnhandledRejection); viteServer.httpServer?.on('close', () => { process.off('unhandledRejection', handleUnhandledRejection); }); return () =...
No issues found.
setTimeout( async () => loader.webSocketSend(await getViteErrorPayload(errorWithMetadata)), 200, ); } process.on('unhandledRejection', handleUnhandledRejection); viteServer.httpServer?.on('close', () => { process.off('unhandledRejection', handleUnhandledRejection); }); return () =...
@@ -1,9 +1,5 @@ import { AsyncLocalStorage } from 'node:async_hooks'; -import { randomUUID } from 'node:crypto'; -import { existsSync } from 'node:fs'; -import { mkdir, readFile, writeFile } from 'node:fs/promises'; import { IncomingMessage } from 'node:http'; -import { fileURLToPath } from 'node:url'; import type *...
packages/astro/src/vite-plugin-astro-server/plugin.ts
0
TypeScript
1
none
16
51
51
true
fix(cloudflare): experimental chromeDevtoolsWorkspace
15,030
withastro/astro
47,179
TypeScript
ematipico
{ name: '@astrojs/cloudflare:cf-imports', enforce: 'pre', resolveId: { filter: { id: /^cloudflare:/, }, handler(id) { return { id, external: true }; }, }, }, { name: '@astrojs/cloudflare:environment', ...
No issues found.
{ name: '@astrojs/cloudflare:cf-imports', enforce: 'pre', resolveId: { filter: { id: /^cloudflare:/, }, handler(id) { return { id, external: true }; }, }, }, { name: '@astrojs/cloudflare:environment', ...
@@ -1,4 +1,4 @@ -import { createReadStream, copyFileSync, existsSync, readFileSync } from 'node:fs'; +import { createReadStream, existsSync, readFileSync } from 'node:fs'; import { appendFile, stat } from 'node:fs/promises'; import { createRequire } from 'node:module'; import { createInterface } from 'node:readline/...
packages/integrations/cloudflare/src/index.ts
0
TypeScript
1
none
16
51
51
true
feat: remove preview codegen dir
15,044
withastro/astro
47,179
TypeScript
florian-lefebvre
import { existsSync } from 'node:fs'; import type { PluginConfig } from '@cloudflare/vite-plugin'; /** * Checks whether a wrangler file exists at the given path * @param root */ export function hasWranglerConfig(root: URL) { return ( existsSync(new URL('wrangler.jsonc', root)) || existsSync(new URL('wrangler.t...
No issues found.
import { existsSync } from 'node:fs'; import type { PluginConfig } from '@cloudflare/vite-plugin'; /** * Checks whether a wrangler file exists at the given path * @param root */ export function hasWranglerConfig(root: URL) { return ( existsSync(new URL('wrangler.jsonc', root)) || existsSync(new URL('wrangler.t...
@@ -21,6 +21,7 @@ export function defaultCloudflareConfig(): PluginConfig['config'] { // TODO: better way to handle name, maybe package.json#name ? name: 'test-application', compatibility_date: '2025-05-21', + compatibility_flags: ['global_fetch_strictly_public'], main: '@astrojs/cloudflare/entrypoints/ser...
packages/integrations/cloudflare/src/wrangler.ts
0
TypeScript
1
none
16
41
41
true
Update wrangler config template in astro add
15,047
withastro/astro
47,179
TypeScript
matthewp
range: Range.create(start, end), code: message.code, severity: message.severity, source: 'astro', }; } }, provideCodeLenses(document, token) { if (token.isCancellationRequested) return; if (!isJSDocument(document.languageId)) return; if (!context.project.ty...
No issues found.
range: Range.create(start, end), code: message.code, severity: message.severity, source: 'astro', }; } }, provideCodeLenses(document, token) { if (token.isCancellationRequested) return; if (!isJSDocument(document.languageId)) return; if (!context.project.ty...
@@ -14,7 +14,7 @@ import { Range, TextEdit, } from '@volar/language-server'; -import fg from 'fast-glob'; +import { globSync } from 'tinyglobby'; import type { Provide } from 'volar-service-typescript'; import type { TextDocument } from 'vscode-html-languageservice'; import { URI } from 'vscode-uri'; @@ -126,9 ...
packages/language-tools/language-server/src/plugins/astro.ts
0
TypeScript
1
none
16
51
51
true
chore: Replace fast-glob with tinyglobby in language server
15,057
withastro/astro
47,179
TypeScript
fabon-f
after(async () => { await container.close(); await baseContainer.close(); await rootPathContainer.close(); }); // Tests for trailingSlash: 'always' it('should match the API route when request has a trailing slash', async () => { const { req, res, text } = createRequestAndResponse({ method: 'GET', ur...
No issues found.
after(async () => { await container.close(); await baseContainer.close(); await rootPathContainer.close(); }); // Tests for trailingSlash: 'always' it('should match the API route when request has a trailing slash', async () => { const { req, res, text } = createRequestAndResponse({ method: 'GET', ur...
@@ -213,6 +213,29 @@ describe('trailingSlash', () => { assert.equal(res.statusCode, 404); }); + // Test for issue #15095: Query params should not cause 404 when base is set and trailingSlash is never + it('should match root path with query params when base is set and trailingSlash is never', async () => { + con...
packages/astro/test/units/routing/trailing-slash.test.js
0
JavaScript
1
none
16
51
51
true
fix(dev): preserve query params when base path is stripped
15,124
withastro/astro
47,179
TypeScript
eureka928
// as a string and the user is responsible for adding a script tag for the component definition. if (!html && typeof Component === 'string') { // Sanitize tag name because some people might try to inject attributes 🙄 const Tag = sanitizeElementName(Component); const childSlots = Object.values(children).join(''...
No issues found.
// as a string and the user is responsible for adding a script tag for the component definition. if (!html && typeof Component === 'string') { // Sanitize tag name because some people might try to inject attributes 🙄 const Tag = sanitizeElementName(Component); const childSlots = Object.values(children).join(''...
@@ -24,9 +24,9 @@ import { } from './common.js'; import { componentIsHTMLElement, renderHTMLElement } from './dom.js'; import { maybeRenderHead } from './head.js'; -import { createRenderInstruction } from './instruction.js'; +import { createRenderInstruction, isRenderInstruction, type RenderInstruction } from './ins...
packages/astro/src/runtime/server/render/component.ts
0
TypeScript
1
none
16
51
51
true
Fix hydration for framework components in MDX slots
15,150
withastro/astro
47,179
TypeScript
matthewp
export const VIRTUAL_MODULE_ID = 'astro:assets'; export const VIRTUAL_SERVICE_ID = 'virtual:image-service'; export const VALID_INPUT_FORMATS = [ 'jpeg', 'jpg', 'png', 'tiff', 'webp', 'gif', 'svg', 'avif', ] as const; /** * Valid formats that our base services support. * Certain formats can be imported (namely...
No issues found.
export const VIRTUAL_MODULE_ID = 'astro:assets'; export const VIRTUAL_SERVICE_ID = 'virtual:image-service'; export const VALID_INPUT_FORMATS = [ 'jpeg', 'jpg', 'png', 'tiff', 'webp', 'gif', 'svg', 'avif', ] as const; /** * Valid formats that our base services support. * Certain formats can be imported (namely...
@@ -34,4 +34,5 @@ export const DEFAULT_HASH_PROPS = [ 'quality', 'fit', 'position', + 'background', ];
packages/astro/src/assets/consts.ts
0
TypeScript
1
none
16
39
39
true
adds ImageTransform.background
15,153
withastro/astro
47,179
TypeScript
jcayzac
it('Exclude CSS for non-rendered entries', async () => { const app = await fixture.loadTestAdapterApp(); const request = new Request('http://example.com/'); const response = await app.render(request); const html = await response.text(); const $ = cheerio.load(html); // Includes styles assert.equ...
No issues found.
it('Exclude CSS for non-rendered entries', async () => { const app = await fixture.loadTestAdapterApp(); const request = new Request('http://example.com/'); const response = await app.render(request); const html = await response.text(); const $ = cheerio.load(html); // Includes styles assert.equ...
@@ -218,5 +218,25 @@ describe('Content Collections - render()', () => { assert.equal(h2.length, 1); assert.equal(h2.attr('data-components-export-applied'), 'true'); }); + + it('Stops collecting CSS when reaching a propagation stopping point', async () => { + let response = await fixture.fetch('/blog/5-big...
packages/astro/test/content-collections-render.test.js
0
JavaScript
1
none
16
51
51
true
Fix CSS collection in dev mode with content collections
15,167
withastro/astro
47,179
TypeScript
HiDeoo
'scale-down': 'inside', outside: 'outside', inside: 'inside', }; const sharpService: LocalImageService<SharpImageServiceConfig> = { validateOptions: baseService.validateOptions, getURL: baseService.getURL, parseURL: baseService.parseURL, getHTMLAttributes: baseService.getHTMLAttributes, getSrcSet: baseService....
No issues found.
'scale-down': 'inside', outside: 'outside', inside: 'inside', }; const sharpService: LocalImageService<SharpImageServiceConfig> = { validateOptions: baseService.validateOptions, getURL: baseService.getURL, parseURL: baseService.parseURL, getHTMLAttributes: baseService.getHTMLAttributes, getSrcSet: baseService....
@@ -1,4 +1,4 @@ -import type { FitEnum, FormatEnum, SharpOptions } from 'sharp'; +import type { FitEnum, FormatEnum, ResizeOptions, SharpOptions } from 'sharp'; import { AstroError, AstroErrorData } from '../../core/errors/index.js'; import type { ImageFit, ImageOutputFormat, ImageQualityPreset } from '../types.js'; ...
packages/astro/src/assets/services/sharp.ts
0
TypeScript
1
none
16
51
51
true
feat(sharp): add kernel option to image service config
15,171
withastro/astro
47,179
TypeScript
mark-ignacio
}, { url: '/also-ignored.woff', type: 'woff', collectPreload: false, data: { weight: '500', style: 'normal', subset: undefined }, init: null, }, ]); }); it('computes the format correctly', () => { const urlProxy = new SpyUrlProxy(); const fonts = resolveLocalFont({ ...
No issues found.
}, { url: '/also-ignored.woff', type: 'woff', collectPreload: false, data: { weight: '500', style: 'normal', subset: undefined }, init: null, }, ]); }); it('computes the format correctly', () => { const urlProxy = new SpyUrlProxy(); const fonts = resolveLocalFont({ ...
@@ -15,6 +15,7 @@ describe('fonts providers', () => { assert.equal(fontProviders.fontshare().name, 'fontshare'); assert.equal(fontProviders.fontsource().name, 'fontsource'); assert.equal(fontProviders.google().name, 'google'); + assert.equal(fontProviders.googleicons().name, 'googleicons'); }); it...
packages/astro/test/units/assets/fonts/providers.test.js
0
JavaScript
1
none
16
51
51
true
feat(fonts): export googleicons provider
15,174
withastro/astro
47,179
TypeScript
florian-lefebvre
assert.equal(headers.get('Pragma'), 'no-cache'); assert.equal(headers.get('Expires'), '0'); }); }); it('Respects config to build links', async () => { const { fixture, run } = await createDevFixture({ base: '/my-base', build: { assets: '_custom', assetsPrefix: 'https://cdn.example.c...
No issues found.
assert.equal(headers.get('Pragma'), 'no-cache'); assert.equal(headers.get('Expires'), '0'); }); }); it('Respects config to build links', async () => { const { fixture, run } = await createDevFixture({ base: '/my-base', build: { assets: '_custom', assetsPrefix: 'https://cdn.example.c...
@@ -1,5 +1,6 @@ // @ts-check import assert from 'node:assert/strict'; +import { existsSync } from 'node:fs'; import { readdir } from 'node:fs/promises'; import { describe, it } from 'node:test'; import { fontProviders } from 'astro/config'; @@ -11,6 +12,7 @@ import { loadFixture } from './test-utils.js'; */ asy...
packages/astro/test/fonts.test.js
0
JavaScript
1
none
16
51
51
true
fix: prevent font copying when stopping dev server with q+enter
15,178
withastro/astro
47,179
TypeScript
kedarvartak
{ name: 'Poppins', cssVariable: '--font-test', provider: fontProviders.fontsource(), }, ], }, }); await run(async () => { const res = await fixture.fetch('/get-font-buffer'); const html = await res.text(); const $ = cheerio.load(html); const length = $('#l...
No issues found.
{ name: 'Poppins', cssVariable: '--font-test', provider: fontProviders.fontsource(), }, ], }, }); await run(async () => { const res = await fixture.fetch('/get-font-buffer'); const html = await res.text(); const $ = cheerio.load(html); const length = $('#l...
@@ -5,6 +5,7 @@ import { readdir } from 'node:fs/promises'; import { describe, it } from 'node:test'; import { fontProviders } from 'astro/config'; import * as cheerio from 'cheerio'; +import testAdapter from './test-adapter.js'; import { loadFixture } from './test-utils.js'; /** @@ -27,6 +28,7 @@ async function...
packages/astro/test/fonts.test.js
0
JavaScript
1
none
16
51
51
true
feat(fonts): getFontBuffer()
15,182
withastro/astro
47,179
TypeScript
florian-lefebvre
import z from 'zod/v4'; export const SessionDriverConfigSchema = z.object({ config: z.record(z.string(), z.any()).optional(), entrypoint: z.union([z.string(), z.instanceof(URL)]), }); export const SessionSchema = z.object({ driver: z .union([ z.string().superRefine(() => { console.warn( // TODO: upda...
No issues found.
import z from 'zod/v4'; export const SessionDriverConfigSchema = z.object({ config: z.record(z.string(), z.any()).optional(), entrypoint: z.union([z.string(), z.instanceof(URL)]), }); export const SessionSchema = z.object({ driver: z .union([ z.string().superRefine(() => { console.warn( // TODO: upda...
@@ -6,15 +6,17 @@ export const SessionDriverConfigSchema = z.object({ }); export const SessionSchema = z.object({ - driver: z.union([ - z.string().superRefine(() => { - console.warn( - // TODO: update link to stable docs - `Using deprecated \`session.driver\` string signature. Learn how to migrate: https:/...
packages/astro/src/core/session/config.ts
0
TypeScript
1
none
16
36
36
true
Make session.driver optional in config schema
15,208
withastro/astro
47,179
TypeScript
matthewp
supportedAstroFeatures: { serverOutput: 'stable', envGetSecret: 'stable', staticOutput: 'stable', hybridOutput: 'stable', assets: 'stable', i18nDomains: 'stable', }, adapterFeatures: { buildOutput: 'server', experimentalStaticHeaders: staticHeaders, },...
No issues found.
supportedAstroFeatures: { serverOutput: 'stable', envGetSecret: 'stable', staticOutput: 'stable', hybridOutput: 'stable', assets: 'stable', i18nDomains: 'stable', }, adapterFeatures: { buildOutput: 'server', experimentalStaticHeaders: staticHeaders, },...
@@ -151,3 +151,143 @@ export default function ({ }, }; } + +export function selfTestAdapter({ + provideAddress = true, + staticHeaders = false, + extendAdapter, + setMiddlewareEntryPoint, + setManifest, + setRouteToHeaders, + env, +} = {}) { + return { + name: 'my-ssr-adapter', + hooks: { + 'astro:config:setu...
packages/astro/test/test-adapter.js
0
JavaScript
1
none
16
51
51
true
fix(build): server entry regression
15,269
withastro/astro
47,179
TypeScript
ematipico
import type { RSSOptions } from './index.js'; /** Normalize URL to its canonical form */ export function createCanonicalURL( url: string, trailingSlash?: RSSOptions['trailingSlash'], base?: string, ): string { let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical if (!getUrlExtension(url...
No issues found.
import type { RSSOptions } from './index.js'; /** Normalize URL to its canonical form */ export function createCanonicalURL( url: string, trailingSlash?: RSSOptions['trailingSlash'], base?: string, ): string { let pathname = url.replace(/\/index.html$/, ''); // index.html is not canonical if (!getUrlExtension(url...
@@ -1,4 +1,3 @@ -import type { z } from 'zod/v3'; import type { RSSOptions } from './index.js'; /** Normalize URL to its canonical form */ @@ -37,17 +36,3 @@ function getUrlExtension(url: string) { const lastSlash = url.lastIndexOf('/'); return lastDot > lastSlash ? url.slice(lastDot + 1) : ''; } - -const flat...
packages/astro-rss/src/util.ts
0
TypeScript
1
none
16
39
39
true
Astro 6 astrojs/rss fix for Zod 4
15,283
withastro/astro
47,179
TypeScript
eldair
logger: new Logger({ level: 'info', dest: new Writable({ objectMode: true, write(event, _, callback) { buildLogs.push(event); callback(); }, }), }), }); }); it('css and js files do not get bundled', async () => { let indexHtml = await fixture.readFile('/index.html'); ...
No issues found.
logger: new Logger({ level: 'info', dest: new Writable({ objectMode: true, write(event, _, callback) { buildLogs.push(event); callback(); }, }), }), }); }); it('css and js files do not get bundled', async () => { let indexHtml = await fixture.readFile('/index.html'); ...
@@ -1,6 +1,6 @@ import assert from 'node:assert/strict'; import { Writable } from 'node:stream'; -import { before, describe, it } from 'node:test'; +import { after, before, describe, it } from 'node:test'; import { Logger } from '../dist/core/logger/core.js'; import { loadFixture } from './test-utils.js'; @@ -47,...
packages/astro/test/astro-public.test.js
0
JavaScript
1
none
16
51
51
true
Fix public files taking priority over API routes in build
15,331
withastro/astro
47,179
TypeScript
matthewp
// The HTML should NOT contain the frontmatter assert.ok(!html.includes('title: Test Post'), 'HTML should not contain frontmatter title'); assert.ok(!html.includes('description:'), 'HTML should not contain frontmatter description'); // The HTML should contain the actual content assert.ok(html.includes(...
No issues found.
// The HTML should NOT contain the frontmatter assert.ok(!html.includes('title: Test Post'), 'HTML should not contain frontmatter title'); assert.ok(!html.includes('description:'), 'HTML should not contain frontmatter description'); // The HTML should contain the actual content assert.ok(html.includes(...
@@ -327,6 +327,76 @@ describe('Content Layer', () => { assert.equal(json.increment.data.slug, 'slimy'); }); + it('renderMarkdown parses frontmatter correctly', async () => { + const entry = json.renderMarkdownTest; + assert.ok(entry, 'renderMarkdownTest entry should exist'); + + // The frontmatter shoul...
packages/astro/test/content-layer.test.js
0
JavaScript
1
none
16
51
51
true
feat: add frontmatter parsing and fileURL option to renderMarkdown
15,332
withastro/astro
47,179
TypeScript
matthewp
import { useState, useEffect } from 'preact/hooks'; export default function Counter() { const [count, setCount] = useState(0); useEffect(() => { console.log('Preact useEffect called'); }, []); return ( <div id="preact-counter"> <p>Preact count: {count}</p> <button onClick={() => setCount(count + 1)}>In...
No issues found.
import { useState, useEffect } from 'preact/hooks'; export default function Counter() { const [count, setCount] = useState(0); useEffect(() => { console.log('Preact useEffect called'); }, []); return ( <div id="preact-counter"> <p>Preact count: {count}</p> <button onClick={() => setCount(count + 1)}>In...
@@ -0,0 +1,16 @@ +import { useState, useEffect } from 'preact/hooks'; + +export default function Counter() { + const [count, setCount] = useState(0); + + useEffect(() => { + console.log('Preact useEffect called'); + }, []); + + return ( + <div id="preact-counter"> + <p>Preact count: {count}</p> + <button onClick=...
packages/astro/e2e/fixtures/cloudflare/src/components/preact/Counter.tsx
0
TypeScript
1
none
16
17
17
true
fix(preact): include server.js in SSR optimizeDeps for Cloudflare
15,383
withastro/astro
47,179
TypeScript
matthewp
/** * Re-exports utilities for use by astro add CLI. * This provides a resolvable path from the user's project. */ export { getLocalWorkerdCompatibilityDate } from '@cloudflare/vite-plugin';
No issues found.
/** * Re-exports utilities for use by astro add CLI. * This provides a resolvable path from the user's project. */ export { getLocalWorkerdCompatibilityDate } from '@cloudflare/vite-plugin';
@@ -0,0 +1,5 @@ +/** + * Re-exports utilities for use by astro add CLI. + * This provides a resolvable path from the user's project. + */ +export { getLocalWorkerdCompatibilityDate } from '@cloudflare/vite-plugin';
packages/integrations/cloudflare/src/info.ts
0
TypeScript
1
none
16
6
6
true
in `astro add cloudflare` use cloudflare/vite-plugin's function to get latest compatibility date for wrangler.jsonc scaffolding
15,386
withastro/astro
47,179
TypeScript
OliverSpeir
import cloudflare from '@astrojs/cloudflare'; import { defineConfig } from 'astro/config'; export default defineConfig({ adapter: cloudflare(), });
No issues found.
import cloudflare from '@astrojs/cloudflare'; import { defineConfig } from 'astro/config'; export default defineConfig({ adapter: cloudflare(), });
@@ -3,10 +3,5 @@ import { defineConfig } from 'astro/config'; export default defineConfig({ - adapter: cloudflare({ - workerEntryPoint: { - path: 'src/worker.ts', - namedExports: ['default', 'MyDurableObject'] - } - }), + adapter: cloudflare(), });
packages/integrations/cloudflare/test/fixtures/custom-entryfile/astro.config.mjs
0
JavaScript
1
none
16
8
8
true
chore(cloudflare): remove workerEntryPoint option
15,400
withastro/astro
47,179
TypeScript
florian-lefebvre
); }); it('allows injecting custom styles resources and hashes based on pages', async () => { fixture = await loadFixture({ root: './fixtures/csp/', outDir: './dist/inject-styles/', security: { csp: { directives: ["img-src 'self'"], styleDirective: { resources: ['https://global.cdn.e...
No issues found.
); }); it('allows injecting custom styles resources and hashes based on pages', async () => { fixture = await loadFixture({ root: './fixtures/csp/', outDir: './dist/inject-styles/', security: { csp: { directives: ["img-src 'self'"], styleDirective: { resources: ['https://global.cdn.e...
@@ -396,6 +396,62 @@ describe('CSP', () => { assert.equal(meta.attr('content').toString().includes('font-src'), false); }); + it('should generate hashes for Image component inline styles when using layout', async () => { + fixture = await loadFixture({ + root: './fixtures/csp/', + outDir: './dist/csp-image'...
packages/astro/test/csp.test.js
0
JavaScript
1
none
16
51
51
true
feat(csp): support responsive images
15,407
withastro/astro
47,179
TypeScript
ematipico
/** * Vite plugin that exposes adapter configuration as a virtual module. * Makes adapter config (args, exports, features, entrypoint) available at runtime * so the adapter can access its own configuration during SSR. */ function vitePluginAdapterConfig(adapter: LegacyAdapter): VitePlugin { return { name: '@ast...
No issues found.
/** * Vite plugin that exposes adapter configuration as a virtual module. * Makes adapter config (args, exports, features, entrypoint) available at runtime * so the adapter can access its own configuration during SSR. */ function vitePluginAdapterConfig(adapter: LegacyAdapter): VitePlugin { return { name: '@ast...
@@ -4,16 +4,22 @@ import type { BuildInternals } from '../internal.js'; import type { StaticBuildOptions } from '../types.js'; import { ASTRO_VITE_ENVIRONMENT_NAMES } from '../../constants.js'; -const SSR_VIRTUAL_MODULE_ID = 'virtual:astro:legacy-ssr-entry'; -export const RESOLVED_SSR_VIRTUAL_MODULE_ID = '\0' + SSR...
packages/astro/src/core/build/plugins/plugin-ssr.ts
0
TypeScript
1
none
16
51
51
true
feat: better adapter type
15,412
withastro/astro
47,179
TypeScript
florian-lefebvre
import { middlewareSecret, skewProtection } from 'virtual:astro-vercel:config'; import { createApp } from 'astro/app/entrypoint'; setGetEnv((key) => process.env[key]); const app = createApp(); export default { async fetch(request: Request): Promise<Response> { const url = new URL(request.url); const realPath = ...
No issues found.
import { middlewareSecret, skewProtection } from 'virtual:astro-vercel:config'; import { createApp } from 'astro/app/entrypoint'; setGetEnv((key) => process.env[key]); const app = createApp(); export default { async fetch(request: Request): Promise<Response> { const url = new URL(request.url); const realPath = ...
@@ -1,68 +1,63 @@ -import type { IncomingMessage, ServerResponse } from 'node:http'; -import type { SSRManifest } from 'astro'; -import { NodeApp } from 'astro/app/node'; import { setGetEnv } from 'astro/env/setup'; import { ASTRO_LOCALS_HEADER, ASTRO_MIDDLEWARE_SECRET_HEADER, ASTRO_PATH_HEADER, ASTRO_PATH_PA...
packages/integrations/vercel/src/serverless/entrypoint.ts
0
TypeScript
1
none
16
51
51
true
feat: convert netlify and vercel adapters to new API
15,413
withastro/astro
47,179
TypeScript
florian-lefebvre
}); it('rejects empty strings', () => { assert.ok(!NPM_PACKAGE_NAME_REGEX.test('')); }); it('rejects names starting with dots', () => { assert.ok(!NPM_PACKAGE_NAME_REGEX.test('.package')); assert.ok(!NPM_PACKAGE_NAME_REGEX.test('..package')); }); it('rejects names starting with underscores', () ...
No issues found.
}); it('rejects empty strings', () => { assert.ok(!NPM_PACKAGE_NAME_REGEX.test('')); }); it('rejects names starting with dots', () => { assert.ok(!NPM_PACKAGE_NAME_REGEX.test('.package')); assert.ok(!NPM_PACKAGE_NAME_REGEX.test('..package')); }); it('rejects names starting with underscores', () ...
@@ -0,0 +1,198 @@ +import assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; +import { NPM_PACKAGE_NAME_REGEX } from '@astrojs/internal-helpers/cli'; + +describe('NPM Package Name Validation', () => { + describe('Valid package names', () => { + it('accepts simple lowercase names', () => { + ...
packages/create-astro/test/package-name-validation.test.js
0
JavaScript
1
none
16
51
51
true
fix(create-astro): make --add stricter
15,419
withastro/astro
47,179
TypeScript
ematipico
import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { parseHTML } from 'linkedom'; import { loadFixture } from '../../../astro/test/test-utils.js'; async function getFixture() { return await loadFixture({ root: new URL('./fixtures/render-table-attrs/', import.meta.url), }); } ...
No issues found.
import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { parseHTML } from 'linkedom'; import { loadFixture } from '../../../astro/test/test-utils.js'; async function getFixture() { return await loadFixture({ root: new URL('./fixtures/render-table-attrs/', import.meta.url), }); } ...
@@ -0,0 +1,49 @@ +import assert from 'node:assert/strict'; +import { describe, it } from 'node:test'; +import { parseHTML } from 'linkedom'; +import { loadFixture } from '../../../astro/test/test-utils.js'; + +async function getFixture() { + return await loadFixture({ + root: new URL('./fixtures/render-table-attrs/', ...
packages/integrations/markdoc/test/render-table-attrs.test.js
0
JavaScript
1
none
16
50
50
true
fix(markdoc): resolve custom attributes on built-in table tag
15,457
withastro/astro
47,179
TypeScript
AhmadYasser1
}); it('should load the custom entry when using self entrypoint', async () => { fixture = await loadFixture({ root: './fixtures/server-entry', output: 'server', adapter: selfTestAdapter(), build: { serverEntry: 'custom.mjs', }, }); await fixture.build({}); app = await fixture.loadSelfAdap...
No issues found.
}); it('should load the custom entry when using self entrypoint', async () => { fixture = await loadFixture({ root: './fixtures/server-entry', output: 'server', adapter: selfTestAdapter(), build: { serverEntry: 'custom.mjs', }, }); await fixture.build({}); app = await fixture.loadSelfAdap...
@@ -1,3 +1,5 @@ +// @ts-check + import { describe, it } from 'node:test'; import { loadFixture } from './test-utils.js'; import testAdapter, { selfTestAdapter } from './test-adapter.js'; @@ -21,8 +23,8 @@ describe('Server entry', () => { }, }); - await fixture.build(); - app = await fixture.loadTestAdapte...
packages/astro/test/server-entry.test.js
0
JavaScript
1
none
16
51
51
true
feat: support serverEntrypoint for self adapters
15,460
withastro/astro
47,179
TypeScript
florian-lefebvre
return opts.settings.config.build.serverEntry; } else { return '[name].mjs'; } }, }, }, ssr: true, ssrEmitAssets: true, // improve build performance minify: false, modulePreload: { polyfill: false }, reportCompressedSize: false, }, plugins, // Top-level buil...
No issues found.
return opts.settings.config.build.serverEntry; } else { return '[name].mjs'; } }, }, }, ssr: true, ssrEmitAssets: true, // improve build performance minify: false, modulePreload: { polyfill: false }, reportCompressedSize: false, }, plugins, // Top-level buil...
@@ -22,6 +22,7 @@ import { trackPageData } from './internal.js'; import { getAllBuildPlugins } from './plugins/index.js'; import { manifestBuildPostHook } from './plugins/plugin-manifest.js'; import { + isLegacyAdapter, LEGACY_SSR_ENTRY_VIRTUAL_MODULE, RESOLVED_LEGACY_SSR_ENTRY_VIRTUAL_MODULE, } from './plugins...
packages/astro/src/core/build/static-build.ts
0
TypeScript
1
none
16
51
51
true
feat: improve naming of new adapter api
15,461
withastro/astro
47,179
TypeScript
florian-lefebvre
import type { AstroAdapterFeatures, MiddlewareMode } from '../types/public/integrations.js'; /** * Resolves the middleware mode from adapter features. * Handles backward compatibility with the deprecated `edgeMiddleware` flag. * * @example * ```ts * // New way * resolveMiddlewareMode({ middlewareMode: 'always'...
No issues found.
import type { AstroAdapterFeatures, MiddlewareMode } from '../types/public/integrations.js'; /** * Resolves the middleware mode from adapter features. * Handles backward compatibility with the deprecated `edgeMiddleware` flag. * * @example * ```ts * // New way * resolveMiddlewareMode({ middlewareMode: 'always'...
@@ -0,0 +1,35 @@ +import type { AstroAdapterFeatures, MiddlewareMode } from '../types/public/integrations.js'; + +/** + * Resolves the middleware mode from adapter features. + * Handles backward compatibility with the deprecated `edgeMiddleware` flag. + * + * @example + * ```ts + * // New way + * resolveMiddlewareMode...
packages/astro/src/integrations/adapter-utils.ts
0
TypeScript
1
none
16
36
36
true
feat: refactor `edgemiddleware` into `middlewareMode` adapter feature
15,495
withastro/astro
47,179
TypeScript
leekeh
serverEntrypoint: '@my-ssr', exports: ['manifest', 'createApp'], supportedAstroFeatures: { serverOutput: 'stable', envGetSecret: 'stable', staticOutput: 'stable', hybridOutput: 'stable', assets: 'stable', i18nDomains: 'stable', }, adapterFeatures: { bui...
No issues found.
serverEntrypoint: '@my-ssr', exports: ['manifest', 'createApp'], supportedAstroFeatures: { serverOutput: 'stable', envGetSecret: 'stable', staticOutput: 'stable', hybridOutput: 'stable', assets: 'stable', i18nDomains: 'stable', }, adapterFeatures: { bui...
@@ -279,9 +279,9 @@ export function selfTestAdapter({ setManifest(manifest); } }, - 'astro:build:generated': ({ experimentalRouteToHeaders }) => { + 'astro:build:generated': ({ routeToHeaders }) => { if (setRouteToHeaders) { - setRouteToHeaders(experimentalRouteToHeaders); + setRouteToHe...
packages/astro/test/test-adapter.js
0
JavaScript
1
none
16
51
51
true
feat: improve AstroAdapter jsdocs
15,550
withastro/astro
47,179
TypeScript
florian-lefebvre
remotePatterns: imageConfig.remotePatterns ?? [], } : undefined; if (!allowlistConfig) { const parsedUrl = new URL(url); if (!['http:', 'https:'].includes(parsedUrl.protocol)) { throw new AstroError({ ...AstroErrorData.FailedToFetchRemoteImageDimensions, message: AstroErrorData.FailedToFetchRe...
No issues found.
remotePatterns: imageConfig.remotePatterns ?? [], } : undefined; if (!allowlistConfig) { const parsedUrl = new URL(url); if (!['http:', 'https:'].includes(parsedUrl.protocol)) { throw new AstroError({ ...AstroErrorData.FailedToFetchRemoteImageDimensions, message: AstroErrorData.FailedToFetchRe...
@@ -1,17 +1,64 @@ +import { isRemoteAllowed } from '@astrojs/internal-helpers/remote'; import { AstroError, AstroErrorData } from '../../core/errors/index.js'; +import type { AstroConfig } from '../../types/public/config.js'; import type { ImageMetadata } from '../types.js'; import { imageMetadata } from './metadata...
packages/astro/src/assets/utils/remoteProbe.ts
0
TypeScript
1
none
16
51
51
true
Respect remote image allowlists
15,586
withastro/astro
47,179
TypeScript
matthewp
import assert from 'node:assert/strict'; import { before, describe, it } from 'node:test'; import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; // Regression test for https://github.com/withastro/astro/issues/15575 // SVG images in content collection image() fields combined with top-level...
No issues found.
import assert from 'node:assert/strict'; import { before, describe, it } from 'node:test'; import * as cheerio from 'cheerio'; import { loadFixture } from './test-utils.js'; // Regression test for https://github.com/withastro/astro/issues/15575 // SVG images in content collection image() fields combined with top-level...
@@ -0,0 +1,40 @@ +import assert from 'node:assert/strict'; +import { before, describe, it } from 'node:test'; +import * as cheerio from 'cheerio'; +import { loadFixture } from './test-utils.js'; + +// Regression test for https://github.com/withastro/astro/issues/15575 +// SVG images in content collection image() fields...
packages/astro/test/content-collection-tla-svg.test.js
0
JavaScript
1
none
16
41
41
true
fix(assets): prevent circular dependency deadlock with SVG in content collections
15,603
withastro/astro
47,179
TypeScript
0xRozier
const islandRes = await fixture.fetch(urlMatch[1]); assert.equal(islandRes.status, 200); const islandHtml = await islandRes.text(); assert.ok(islandHtml.includes('<script'), 'island response should include the script tag from the slotted component'); assert.ok(islandHtml.includes('data-increment'), ...
No issues found.
const islandRes = await fixture.fetch(urlMatch[1]); assert.equal(islandRes.status, 200); const islandHtml = await islandRes.text(); assert.ok(islandHtml.includes('<script'), 'island response should include the script tag from the slotted component'); assert.ok(islandHtml.includes('data-increment'), ...
@@ -245,6 +245,20 @@ describe('Server islands', () => { assert.equal(fetchMatch.length, 2, 'should include props in the query string'); assert.equal(fetchMatch[1], '', 'should not include encrypted empty props'); }); + + it('includes script from slotted component in island response', async () => { + ...
packages/astro/test/server-islands.test.js
0
JavaScript
1
none
16
51
51
true
fix: include slot scripts in server island response
15,633
withastro/astro
47,179
TypeScript
jwoyo
// Ensure that this highlighter instance can highlight different languages. const highlighter = Array.from(highlighters)[0]; const html1 = await highlighter.codeToHtml('const foo = "bar";', 'js'); const html2 = await highlighter.codeToHtml('const foo = "bar";', 'ts'); assert.match(html1, /color:#F97583/); a...
No issues found.
// Ensure that this highlighter instance can highlight different languages. const highlighter = Array.from(highlighters)[0]; const html1 = await highlighter.codeToHtml('const foo = "bar";', 'js'); const html2 = await highlighter.codeToHtml('const foo = "bar";', 'ts'); assert.match(html1, /color:#F97583/); a...
@@ -1,6 +1,7 @@ import assert from 'node:assert/strict'; import { describe, it } from 'node:test'; import { createMarkdownProcessor, createShikiHighlighter } from '../dist/index.js'; +import { clearShikiHighlighterCache } from '../dist/shiki.js'; describe('shiki syntax highlighting', () => { it('does not add is...
packages/markdown/remark/test/shiki.test.js
0
JavaScript
1
none
16
51
51
true
fix(markdown-remark): reuse shiki highlighter instance
15,651
withastro/astro
47,179
TypeScript
ocavue
}; } function setActionResult(actionName: string, actionResult: SerializedActionResult) { (context.locals as ActionsLocals)._actionPayload = { actionResult, actionName, }; } return { action, setActionResult, serializeActionResult, deserializeActionResult, }; } function getCallerInfo(ctx: APIC...
No issues found.
}; } function setActionResult(actionName: string, actionResult: SerializedActionResult) { (context.locals as ActionsLocals)._actionPayload = { actionResult, actionName, }; } return { action, setActionResult, serializeActionResult, deserializeActionResult, }; } function getCallerInfo(ctx: APIC...
@@ -195,9 +195,10 @@ export function getActionContext(context: APIContext): AstroActionContext { throw error; } + const bodySizeLimit = pipeline.manifest.actionBodySizeLimit; let input; try { - input = await parseRequestBody(context.request); + input = await parseRequestBody(context.re...
packages/astro/src/actions/runtime/server.ts
0
TypeScript
1
none
16
51
51
true
Make the limit of the body of a POST configurable (port from 5-legacy)
15,657
withastro/astro
47,179
TypeScript
qzio
// The virtual module for the astro:transitions namespace export default function astroTransitions({ settings }: { settings: AstroSettings }): vite.Plugin { return { name: 'astro:transitions', resolveId: { filter: { id: new RegExp(`^(${VIRTUAL_MODULE_ID}|${VIRTUAL_CLIENT_MODULE_ID})$`), }, handler(id)...
No issues found.
// The virtual module for the astro:transitions namespace export default function astroTransitions({ settings }: { settings: AstroSettings }): vite.Plugin { return { name: 'astro:transitions', resolveId: { filter: { id: new RegExp(`^(${VIRTUAL_MODULE_ID}|${VIRTUAL_CLIENT_MODULE_ID})$`), }, handler(id)...
@@ -10,13 +10,6 @@ const RESOLVED_VIRTUAL_CLIENT_MODULE_ID = '\0' + VIRTUAL_CLIENT_MODULE_ID; export default function astroTransitions({ settings }: { settings: AstroSettings }): vite.Plugin { return { name: 'astro:transitions', - config() { - return { - optimizeDeps: { - include: ['astro > cssesc'], - ...
packages/astro/src/transitions/vite-plugin-transitions.ts
0
TypeScript
1
none
16
51
51
true
feat: vendor cssesc
15,669
withastro/astro
47,179
TypeScript
florian-lefebvre
assert.ok(html.includes('.bg-amber-500'), 'Expected .bg-amber-500 class to be in the HTML'); }); }); describe('build', () => { before(async () => { await devServer?.stop(); devServer = undefined; await fixture.build(); }); it('includes Tailwind styles in prerendered page', async () => { // Wi...
No issues found.
assert.ok(html.includes('.bg-amber-500'), 'Expected .bg-amber-500 class to be in the HTML'); }); }); describe('build', () => { before(async () => { await devServer?.stop(); devServer = undefined; await fixture.build(); }); it('includes Tailwind styles in prerendered page', async () => { // Wi...
@@ -43,8 +43,69 @@ describe('Prerendered page styles', () => { it('includes Tailwind styles in prerendered page', async () => { // With cloudflare adapter, prerendered pages are in dist/client/ const html = await fixture.readFile('/client/index.html'); - // Check that the bg-amber-500 class has its styles ...
packages/integrations/cloudflare/test/prerender-styles.test.js
0
JavaScript
1
none
16
51
51
true
fix(assets): Missing styles in Cloudflare + MDX
15,696
withastro/astro
47,179
TypeScript
Princesseuh
void SendString( uint64_t ptr, const char* str, QueueType type ); // Allocated source location data layout: // 4b payload size // 4b color // 4b source line // fsz function name // 1b null terminator // ssz source file name // 1b null terminator // nsz zone name (o...
Passing `nullptr` to `memcpy` is undefined behavior.
void SendString( uint64_t ptr, const char* str, QueueType type ); // Allocated source location data layout: // 4b payload size // 4b color // 4b source line // fsz function name // 1b null terminator // ssz source file name // 1b null terminator // nsz zone name (o...
@@ -483,30 +483,31 @@ class Profiler static tracy_force_inline uint64_t AllocSourceLocation( uint32_t line, const char* source, const char* function ) { - const auto fsz = strlen( function ); - const auto ssz = strlen( source ); - const uint32_t sz = uint32_t( 4 + 4 + 4 + fsz + 1 + ssz ...
client/TracyProfiler.hpp
26
C++
0.5
bug
52
51
51
false
`___tracy_alloc_*` take pointer-size pairs
55
wolfpld/tracy
14,429
C++
wolfpld
nagisa
formatting, { dataPoint } } ); } } } } std::stable_sort( timeline.begin(), timeline.end(), [] ( const auto& l, const auto& r ) { return l.timestamp < r.timestamp; } ); std::stable_sort( messages.begin(),...
Please use braces in non-oneliner case.
formatting, { dataPoint } } ); } } } } std::stable_sort( timeline.begin(), timeline.end(), [] ( const auto& l, const auto& r ) { return l.timestamp < r.timestamp; } ); std::stable_sort( messages.begin(),...
@@ -135,6 +173,9 @@ int main( int argc, char** argv ) } for( auto& v : timeline ) v.timestamp -= mts; for( auto& v : messages ) v.timestamp -= mts; + for( auto& plot : plots ) + for( auto& v : plot.data ) + v.first -= mts;
import-chrome/src/import-chrome.cpp
26
C++
0.143
style
39
51
51
false
Import chrome metrics
58
wolfpld/tracy
14,429
C++
wolfpld
ethercrow
formatting = tracy::PlotValueFormatting::Memory; } plots.emplace_back( tracy::Worker::ImportEventPlots { metricName, formatting, { dataPoint } } ); ...
You need to add a check for minimum value of plots here.
formatting = tracy::PlotValueFormatting::Memory; } plots.emplace_back( tracy::Worker::ImportEventPlots { std::move( metricName ), formatting, { dataPoint } } ); ...
@@ -135,6 +173,9 @@ int main( int argc, char** argv ) }
import-chrome/src/import-chrome.cpp
26
C++
0.214
suggestion
56
51
51
false
Import chrome metrics
58
wolfpld/tracy
14,429
C++
wolfpld
ethercrow
buf[len-1] = 0; } } close( fd ); } # ifndef __ANDROID__ pthread_setcancelstate( cs, 0 ); # endif return buf; # endif #endif sprintf( buf, "%" PRIu64, id ); return buf; } } #ifdef __cplusplus extern "C" { #endif TRACY_API void ___tracy_set_thread_na...
Please add newline at the end of the file.
buf[len-1] = 0; } } close( fd ); } # ifndef __ANDROID__ pthread_setcancelstate( cs, 0 ); # endif return buf; # endif #endif sprintf( buf, "%" PRIu64, id ); return buf; } } #ifdef __cplusplus extern "C" { #endif TRACY_API void ___tracy_set_thread_na...
@@ -237,3 +237,13 @@ TRACY_API const char* GetThreadName( uint64_t id ) } } + +#ifdef __cplusplus +extern "C" { +#endif + +TRACY_API void ___tracy_set_thread_name( const char* name ) { tracy::SetThreadName( name ); } + +#ifdef __cplusplus +} +#endif
common/TracySystem.cpp
26
C++
0.071
style
42
26
27
false
Add set thread name to C API
83
wolfpld/tracy
14,429
C++
wolfpld
zanshi
assert( y1 >= y0 ); assert( sw > 0 ); const auto ww = ImGui::GetItemRectSize().x; if( x0 > ww || x1 < 0 ) return; if( x1 - x0 > ww ) { x0 = std::max<double>( 0, x0 ); x1 = std::min<double>( ww, x1 ); } ImGui::PushClipRect( ImVec2...
I'm not sure about this flooring. It will likely break things when `dpiScale` (main.cpp) isn't 1.
assert( y1 >= y0 ); assert( sw > 0 ); const auto ww = ImGui::GetItemRectSize().x; if( x0 > ww || x1 < 0 ) return; if( x1 - x0 > ww ) { x0 = std::max<double>( 0, x0 ); x1 = std::min<double>( ww, x1 ); } ImGui::PushClipRect( ImVec2...
@@ -183,8 +183,23 @@ namespace tracy const auto rw = x1 - x0; const auto rh = y1 - y0; - const auto v0 = ImVec2( x0, y0 - rw ); const auto cnt = int( ( rh + rw + sw*2 ) / ( sw*2 ) ); + auto v0 = ImVec2( x0, y0 - rw ); + + if ( fix_stripes_in_screen_space ) + { + ...
server/TracyImGui.hpp
26
C++
0.357
suggestion
97
34
49
false
Making find- and stat-zones stripes interleave always by changing DrawStripedRect
86
wolfpld/tracy
14,429
C++
wolfpld
simonvanbernem
close( read_end ); dup2( write_end, STDOUT_FILENO ); close( write_end ); execlp( "su", "su", flag, "id", "-u", nullptr ); exit( EXIT_FAILURE ); } else if( pid > 0 ) { // parent close( write_end ); cha...
Is there a scenario in which this case would be possible?
{ int pipefd[2]; if( pipe( pipefd ) == 0 ) { const auto pid = fork(); if( pid == 0 ) { // child close( pipefd[1] ); if( dup2( pipefd[0], STDIN_FILENO ) >= 0 ) { close( pipefd[0] ); execlp( "su", "su", "ro...
@@ -796,11 +797,180 @@ static void SetupSampling( int64_t& samplingPeriod ) } #ifdef __ANDROID__ + +// The following Android-specific code is motivated by the following Android-specific +// aspects: +// 1. On Android, graphical applications ("intents") never run as root, not even +// if spawned from a root shell...
client/TracySysTrace.cpp
26
C++
0.214
question
57
51
51
false
Fix sampling on Android with default `su` command.
123
wolfpld/tracy
14,429
C++
wolfpld
bjacob
char buf[8] = { 0 }; int read_len = read( read_end, buf, sizeof buf ); if (read_len >= 2) { success = !memcmp(buf, "0\n", 2 ); } close( read_end ); waitpid( pid, nullptr, 0 ); } } return success; } // Enum identifyi...
This should be handled as a failure to setup kernel tracing, in `SysTraceStart()`.
{ close( pipefd[0] ); execlp( "su", "su", "root", "sh", "-c", "cat > /data/tracy_systrace", (char*)nullptr ); exit( 1 ); } } else if( pid > 0 ) { // parent close( pipefd[0] ); #ifdef __aarch64__ ...
@@ -796,11 +797,180 @@ static void SetupSampling( int64_t& samplingPeriod ) } #ifdef __ANDROID__ + +// The following Android-specific code is motivated by the following Android-specific +// aspects: +// 1. On Android, graphical applications ("intents") never run as root, not even +// if spawned from a root shell...
client/TracySysTrace.cpp
26
C++
0.571
bug
82
51
51
false
Fix sampling on Android with default `su` command.
123
wolfpld/tracy
14,429
C++
wolfpld
bjacob
// that its output is `0` (the uid of root). // This test is based on the command's stdout and not on the return code, because // it seems that some implementations of `su` don't propagate the command's return // code. static bool TrySuCommandFlag(const char* flag) { bool success = false; int pipefd[2]; if(...
Use just `{}`, there's no need to explicitly init the first element to 0 (it will be initialized implicitly, like the rest of values in buffer).
return true; } if( cnt < 0 ) { close( fd ); return false; } vsz -= cnt; val += cnt; } } #endif #ifdef __ANDROID__ void SysTraceInjectPayload() { int pipefd[2]; if( pipe( pipefd ) == 0 ) { const auto pid = fork()...
@@ -796,11 +797,180 @@ static void SetupSampling( int64_t& samplingPeriod ) } #ifdef __ANDROID__ + +// The following Android-specific code is motivated by the following Android-specific +// aspects: +// 1. On Android, graphical applications ("intents") never run as root, not even +// if spawned from a root shell...
client/TracySysTrace.cpp
26
C++
0.571
nitpick
144
51
51
false
Fix sampling on Android with default `su` command.
123
wolfpld/tracy
14,429
C++
wolfpld
bjacob
// Attempts to make the specified address range readable. bool EnsureReadable( std::uintptr_t start_address, std::uintptr_t end_address ) { // Lock ensuring reentrancy of this function. static std::mutex s_mutex; const std::lock_guard<std::mutex> lock( s_mutex ); // Static state managed by this functio...
oops, leftover debug helpers here, will remove
AppendData( &item, QueueDataSize[(int)QueueType::SymbolInformation] ); if( sym.needFree ) tracy_free( (void*)sym.file ); #endif } void Profiler::HandleSymbolCodeQuery( uint64_t symbol, uint32_t size ) { #ifdef __ANDROID__ // On Android it's common for code to be in mappings that are only executable //...
@@ -2907,8 +2915,195 @@ void Profiler::HandleSymbolQuery( uint64_t symbol ) #endif } +#ifdef __ANDROID__ +// Implementation of EnsureReadable, a helper to ensure that we can read symbols code. +// This is so far only needed on Android, where it is common for libraries to be mapped +// with only executable, not read...
client/TracyProfiler.cpp
26
C++
0.286
bug
48
51
51
false
Ensure that mappings have read permission before decoding symbols and reading code.
129
wolfpld/tracy
14,429
C++
bjacob
bjacob
# include <sys/time.h> # include <sys/param.h> #endif #ifdef __CYGWIN__ # include <windows.h> # include <unistd.h> # include <tlhelp32.h> #endif #ifdef _GNU_SOURCE # include <errno.h> #endif #ifdef __linux__ # include <dirent.h> # include <signal.h> # include <pthread.h> # include <sys/types.h> # include ...
Use C headers (e.g. `stdio.h`) and `std::`-less types.
# include <sys/time.h> # include <sys/param.h> #endif #ifdef __CYGWIN__ # include <windows.h> # include <unistd.h> # include <tlhelp32.h> #endif #ifdef _GNU_SOURCE # include <errno.h> #endif #ifdef __linux__ # include <dirent.h> # include <signal.h> # include <pthread.h> # include <sys/types.h> # include ...
@@ -32,6 +32,14 @@ # include <sys/syscall.h> #endif +#ifdef __ANDROID__ +# include <sys/mman.h> +# include <cstdio> +# include <cstdint>
client/TracyProfiler.cpp
26
C++
0.571
suggestion
54
51
51
false
Ensure that mappings have read permission before decoding symbols and reading code.
129
wolfpld/tracy
14,429
C++
wolfpld
bjacob
// The current mapping starts after the remainder of the address // range that we needs to cover, so some of that address range // isn't covered by any mapping. return false; } remainder_start_address = it->end_address; ++it; } // Some of t...
The function interface tells me that `mapping` may be `nullptr` here. Change it to a reference to ensure a valid object is always passed to the function.
return true; } int prot = PROT_READ; if( mapping.perm_w ) prot |= PROT_WRITE; if( mapping.perm_x ) prot |= PROT_EXEC; if( mprotect( reinterpret_cast<void*>( mapping.start_address ), mapping.end_address - mapping.start_address, prot ) == -1 ) { // Failed to make ...
@@ -2907,8 +2915,195 @@ void Profiler::HandleSymbolQuery( uint64_t symbol ) #endif } +#ifdef __ANDROID__ +// Implementation of EnsureReadable, a helper to ensure that we can read symbols code. +// This is so far only needed on Android, where it is common for libraries to be mapped +// with only executable, not read...
client/TracyProfiler.cpp
26
C++
0.714
bug
153
51
51
false
Ensure that mappings have read permission before decoding symbols and reading code.
129
wolfpld/tracy
14,429
C++
wolfpld
bjacob
// Attempts to make the specified address range readable. bool EnsureReadable( std::uintptr_t start_address, std::uintptr_t end_address ) { // Lock ensuring reentrancy of this function. static std::mutex s_mutex; const std::lock_guard<std::mutex> lock( s_mutex ); // Static state managed by this function...
I don't think it would be possible to have one symbol span multiple memory mappings?
if( sym.needFree ) tracy_free( (void*)sym.file ); #endif } void Profiler::HandleSymbolCodeQuery( uint64_t symbol, uint32_t size ) { #ifdef __ANDROID__ // On Android it's common for code to be in mappings that are only executable // but not readable. if( !EnsureReadable( symbol ) ) { return...
@@ -2907,8 +2915,195 @@ void Profiler::HandleSymbolQuery( uint64_t symbol ) #endif } +#ifdef __ANDROID__ +// Implementation of EnsureReadable, a helper to ensure that we can read symbols code. +// This is so far only needed on Android, where it is common for libraries to be mapped +// with only executable, not read...
client/TracyProfiler.cpp
26
C++
0.357
question
84
51
51
false
Ensure that mappings have read permission before decoding symbols and reading code.
129
wolfpld/tracy
14,429
C++
wolfpld
bjacob
mapping.start_address = start_addr; mapping.end_address = end_addr; mapping.perm_r = perm[0] == 'r'; mapping.perm_w = perm[1] == 'w'; mapping.perm_x = perm[2] == 'x'; } fclose( file ); return result; } // Internal implementation helper for LookUpMapping(address). // ...
This should be `( const MappingInfo& m1, uintptr_t m2 )`. Then you don't need to construct `needle` struct above, and just pass `address` to `std::lower_bound`.
mapping.start_address = start_addr; mapping.end_address = end_addr; mapping.perm_r = perm[0] == 'r'; mapping.perm_w = perm[1] == 'w'; mapping.perm_x = perm[2] == 'x'; } fclose( file ); return result; } // Internal implementation helper for LookUpMapping(address). // ...
@@ -2889,9 +2897,162 @@ void Profiler::HandleParameter( uint64_t payload ) TracyLfqCommit; } +#ifdef __ANDROID__ +namespace { +// Implementation helpers of EnsureReadable(address). +// This is so far only needed on Android, where it is common for libraries to be mapped +// with only executable, not readable, pe...
client/TracyProfiler.cpp
26
C++
0.571
suggestion
160
51
51
false
Ensure that mappings have read permission before decoding symbols and reading code.
129
wolfpld/tracy
14,429
C++
wolfpld
bjacob
{ uint64_t thread; }; struct QueueZoneBeginLean { int64_t time; }; struct QueueZoneBegin : public QueueZoneBeginLean { uint64_t srcloc; // ptr }; struct QueueZoneEnd { int64_t time; }; struct QueueZoneValidation { uint32_t id; }; struct QueueZoneColor { uint32_t value; }; struct QueueZone...
This should be 3 bytes (alpha is ignored).
{ uint64_t thread; }; struct QueueZoneBeginLean { int64_t time; }; struct QueueZoneBegin : public QueueZoneBeginLean { uint64_t srcloc; // ptr }; struct QueueZoneEnd { int64_t time; }; struct QueueZoneValidation { uint32_t id; }; struct QueueZoneColor { uint8_t r; uint8_t g; uint...
@@ -124,6 +125,10 @@ struct QueueZoneValidation uint32_t id; }; +struct QueueZoneColor { + uint32_t value;
common/TracyQueue.hpp
26
C++
0.143
suggestion
42
51
51
false
Adding ZoneColor to set a dynamic color override to an existing zone.
137
wolfpld/tracy
14,429
C++
wolfpld
benvanik
{ freopen( "CONOUT$", "w", stderr ); fprintf( stderr, "Tracy Profiler initialization failure: %s\n", msg ); } } else { MessageBoxA( nullptr, msg, "Tracy Profiler initialization failure", MB_ICONSTOP ); } #else fprintf( stderr, "Tracy Profiler initializ...
I'd prefer to keep the `getenv()` interface, so that this silly buffer business can be omitted. You can just use static char buffer in `GetEnvVar()`, if needed.
return Profiler::GetTime(); } #else static int64_t SetupHwTimer() { return Profiler::GetTime(); } #endif static const char* GetProcessName() { const char* processName = "unknown"; #ifdef _WIN32 static char buf[_MAX_PATH]; GetModuleFileNameA( nullptr, buf, _MAX_PATH ); const char* ptr = buf; ...
@@ -234,7 +270,8 @@ static int64_t SetupHwTimer() CpuId( regs, 0x80000007 ); if( !( regs[3] & ( 1 << 8 ) ) ) { - const char* noCheck = getenv( "TRACY_NO_INVARIANT_CHECK" ); + char buffer[32]; + const char* noCheck = GetEnvVar( "TRACY_NO_INVARIANT_CHECK", buffer, sizeof(buffer) / size...
client/TracyProfiler.cpp
26
C++
0.571
suggestion
160
51
51
false
Windows getenv fix
195
wolfpld/tracy
14,429
C++
wolfpld
jkriegshauser
{ fprintf( stderr, "Input must be either an array of events or an object containing an array of events under \"traceEvents\" key.\n" ); exit( 1 ); } for( auto& v : j ) { const auto type = v["ph"].get<std::string>(); std::string zoneText = ""; if ( v.contains( "a...
Why is PID extracted here, but TIDs are inside the `if` bodies?
return pseudo_tid; } else { return real_tid; } }; if( j.is_object() && j.contains( "traceEvents" ) ) { j = j["traceEvents"]; } if( !j.is_array() ) { fprintf( stderr, "Input must be either an array of events or an object cont...
@@ -158,14 +177,23 @@ int main( int argc, char** argv ) { for ( auto& kv : v["args"].items() ) { - zoneText += kv.key() + ": " + kv.value().dump() + "\n"; + const auto val = kv.value(); + const std::string s = + val.is_st...
import-chrome/src/import-chrome.cpp
26
C++
0.429
refactor
63
51
51
false
chrome-import: handle multiple pids
211
wolfpld/tracy
14,429
C++
wolfpld
c-cube
std::ifstream is( input ); if( !is.is_open() ) { fprintf( stderr, "Cannot open input file!\n" ); exit( 1 ); } is >> j; is.close(); } printf( "\33[2KParsing...\r" ); fflush( stdout ); struct PidTid { uint64_t tid; uint6...
This has to be better named. There are two different meanings for `tid`. At the same time, `tid` and `both` are used as aliases.
std::ifstream is( input ); if( !is.is_open() ) { fprintf( stderr, "Cannot open input file!\n" ); exit( 1 ); } is >> j; is.close(); } printf( "\33[2KParsing...\r" ); fflush( stdout ); // encode a pair of "real pid, real tid" from a...
@@ -133,11 +133,30 @@ int main( int argc, char** argv ) printf( "\33[2KParsing...\r" ); fflush( stdout ); + struct PidTid { + uint64_t tid; + uint64_t pid; + uint64_t both; // fake thread id, unique within Tracy + }; + + std::vector<PidTid> tids; std::vector<tracy::Worker::Impor...
import-chrome/src/import-chrome.cpp
26
C++
0.571
suggestion
128
51
51
false
chrome-import: handle multiple pids
211
wolfpld/tracy
14,429
C++
wolfpld
c-cube
uint64_t tid; uint64_t pid; uint64_t pseudo_tid; // fake thread id, unique within Tracy }; std::vector<PidTidEncoder> tid_encoders; std::vector<tracy::Worker::ImportEventTimeline> timeline; std::vector<tracy::Worker::ImportEventMessages> messages; std::vector<tracy::Worker::Import...
I don't think this is a good solution. Someone may be depending on the actual TID values to be displayed, and this method of assigning pseudo TIDs squashes them all into an ordered list.
uint64_t tid; uint64_t pid; uint64_t pseudo_tid; // fake thread id, unique within Tracy }; std::vector<PidTidEncoder> tid_encoders; std::vector<tracy::Worker::ImportEventTimeline> timeline; std::vector<tracy::Worker::ImportEventMessages> messages; std::vector<tracy::Worker::Import...
@@ -133,11 +133,39 @@ int main( int argc, char** argv ) printf( "\33[2KParsing...\r" ); fflush( stdout ); + // encode a pair of "real pid, real tid" from a trace into a + // pseudo thread ID living in the single namespace of Tracy threads. + struct PidTidEncoder { + uint64_t tid; + uint64...
import-chrome/src/import-chrome.cpp
26
C++
0.357
suggestion
186
51
51
false
chrome-import: handle multiple pids
211
wolfpld/tracy
14,429
C++
wolfpld
c-cube
TRACY_API void ___tracy_emit_memory_alloc_named( const void* ptr, size_t size, int secure, const char* name ) { tracy::Profiler::MemAllocNamed( ptr, size, secure != 0, name ); } TRACY_API void ___tracy_emit_memory_alloc_callstack_named( const void* ptr, size_t size, int depth, int secure, const char* name ) { tracy::Pr...
These checks are not neccessary. User can simply not call the function in case of `active == false`.
TRACY_API void ___tracy_emit_memory_alloc_named( const void* ptr, size_t size, int secure, const char* name ) { tracy::Profiler::MemAllocNamed( ptr, size, secure != 0, name ); } TRACY_API void ___tracy_emit_memory_alloc_callstack_named( const void* ptr, size_t size, int depth, int secure, const char* name ) { tracy::Pr...
@@ -3965,6 +3965,74 @@ TRACY_API uint64_t ___tracy_alloc_srcloc_name( uint32_t line, const char* source return tracy::Profiler::AllocSourceLocation( line, source, sourceSz, function, functionSz, name, nameSz ); } +TRACY_API void ___tracy_emit_gpu_zone_begin_alloc( const struct ___tracy_gpu_zone_begin_data data,...
client/TracyProfiler.cpp
26
C++
0.571
suggestion
100
51
51
false
Implement a bare-bones C API for graphics profiling
283
wolfpld/tracy
14,429
C++
wolfpld
expenses
#define TracyCMessageLC(x,y) #define TracyCAppInfo(x,y) #define TracyCZoneS(x,y,z) #define TracyCZoneNS(x,y,z,w) #define TracyCZoneCS(x,y,z,w) #define TracyCZoneNCS(x,y,z,w,a) #define TracyCAllocS(x,y,z) #define TracyCFreeS(x,y) #define TracyCSecureAllocS(x,y,z) #define TracyCSecureFreeS(x,y) #define TracyCAllocNS(x...
These functions (and the second set below) should probably be named `TracyCFiber...`.
#define TracyCMessageLC(x,y) #define TracyCAppInfo(x,y) #define TracyCZoneS(x,y,z) #define TracyCZoneNS(x,y,z,w) #define TracyCZoneCS(x,y,z,w) #define TracyCZoneNCS(x,y,z,w,a) #define TracyCAllocS(x,y,z) #define TracyCFreeS(x,y) #define TracyCSecureAllocS(x,y,z) #define TracyCSecureFreeS(x,y) #define TracyCAllocNS(x...
@@ -73,6 +73,11 @@ typedef const void* TracyCZoneCtx; #define TracyCMessageCS(x,y,z,w) #define TracyCMessageLCS(x,y,z) +#ifdef TRACY_FIBERS +# define TracyFiberEnter(fiber) +# define TracyFiberLeave
TracyC.h
26
C/C++
0.429
suggestion
85
51
51
false
Add fibers to TracyC.h
288
wolfpld/tracy
14,429
C++
wolfpld
slembcke
void SyncClockAndSendContextInfo() { ZoneScopedC( Color::Red4 ); int64_t tgpu; glGetInteger64v( GL_TIMESTAMP, &tgpu ); int64_t tcpu = Profiler::GetTime(); GLint bits; glGetQueryiv( GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, &bits ); const float period = 1.f; ...
Is the condition order here the way you intended to be? `TRACY_ON_DEMAND_GPU_SYNC` does not make sense without `TRACY_ON_DEMAND`.
void SyncClockAndSendContextInfo() { ZoneScopedC( Color::Red4 ); int64_t tgpu; glGetInteger64v( GL_TIMESTAMP, &tgpu ); int64_t tcpu = Profiler::GetTime(); GLint bits; glGetQueryiv( GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, &bits ); const float period = 1.f; ...
@@ -173,6 +167,38 @@ class GpuCtx } private: + void SyncClockAndSendContextInfo() + { + ZoneScopedC( Color::Red4 ); + + int64_t tgpu; + glGetInteger64v( GL_TIMESTAMP, &tgpu ); + int64_t tcpu = Profiler::GetTime(); + + GLint bits; + glGetQueryiv( GL_TIMESTAMP, GL_Q...
TracyOpenGL.hpp
26
C++
0.5
suggestion
129
51
51
false
Add new TRACY_ON_DEMAND_GPU_SYNC define
303
wolfpld/tracy
14,429
C++
wolfpld
Lectem
auto item = Profiler::QueueSerial(); MemWrite( &item->hdr.type, QueueType::GpuContextName ); MemWrite( &item->gpuContextNameFat.context, (uint8_t)m_contextId ); MemWrite( &item->gpuContextNameFat.ptr, (uint64_t)ptr ); MemWrite( &item->gpuContextNameFat.size, ...
I know this makes the loop more compact, but I genuinely think it makes it less readable and more confusing
auto item = Profiler::QueueSerial(); MemWrite( &item->hdr.type, QueueType::GpuContextName ); MemWrite( &item->gpuContextNameFat.context, (uint8_t)m_contextId ); MemWrite( &item->gpuContextNameFat.ptr, (uint64_t)ptr ); MemWrite( &item->gpuContextNameFat.size, ...
@@ -139,23 +148,33 @@ namespace tracy { } #endif - while (m_tail != m_head) + for (; m_tail != m_head; m_tail = (m_tail + 1) % QueryCount)
TracyOpenCL.hpp
26
C++
0.357
suggestion
107
51
51
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan
#include <CL/cl.h> #include <Tracy.hpp> #include <TracyOpenCL.hpp> #define CL_ASSERT(err) \ if((err) != CL_SUCCESS) \ { \ std::cerr << "OpenCL Call Returne...
As far as I'm aware you don't need to do this if click the connect button before running the application. Also, since this is a short-lived application, defining the environment variable `TRACY_NO_EXIT=1` should prevent it from exiting too quickly.
#include <Tracy.hpp> #include <TracyOpenCL.hpp> #define CL_ASSERT(err) \ if((err) != CL_SUCCESS) \ { \ std::cerr << "OpenCL Call Returned " << err << std::...
@@ -27,6 +29,10 @@ const char kernelSource[] = int main() { + using namespace std::chrono_literals; + std::cout << "Sleep for 1s to wait profiler connection..." << std::endl; + std::this_thread::sleep_for(1s);
examples/OpenCLVectorAdd/OpenCLVectorAdd.cpp
26
C++
0.643
suggestion
248
51
51
false
Update OpenCL
313
wolfpld/tracy
14,429
C++
mcleary
cloudhan