Skip to content

Commit 20843d7

Browse files
authored
Merge branch 'feat/environment-api' into tests/env-config-alias
2 parents 604e0de + c9b2e7a commit 20843d7

File tree

8 files changed

+39
-30
lines changed

8 files changed

+39
-30
lines changed

biome.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"assist": {
2929
"actions": {
3030
"source": {
31-
"organizeImports": "on"
31+
"organizeImports": "off"
3232
}
3333
}
3434
},
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export { getFallbackRoute, routeIsFallback, routeIsRedirect } from './helpers.js';
1+
export { routeIsRedirect } from './helpers.js';
22
export { createRoutesList } from './manifest/create.js';
33
export { matchAllRoutes } from './match.js';

packages/astro/test/0-css.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,18 @@ describe('CSS', function () {
106106
assert.match(style, /\.comp-c\{/);
107107
assert.doesNotMatch(style, /\.comp-b/);
108108
});
109+
110+
it('CSS modules imported in both frontmatter and script should not duplicate', async () => {
111+
const duplicateHtml = await fixture.readFile('/css-module-duplicate/index.html');
112+
const $duplicate = cheerio.load(duplicateHtml);
113+
const cssHref = $duplicate('link[rel=stylesheet][href^=/_astro/]').attr('href');
114+
const css = await fixture.readFile(cssHref.replace(/^\/?/, '/'));
115+
116+
const normalizedCSS = css.replace(/\s+/g, '');
117+
118+
assert.equal((normalizedCSS.match(/\._duplicate-blue_\w+\{[^}]+\}/gi) || []).length, 1);
119+
assert.equal((normalizedCSS.match(/\._duplicate-red_\w+\{[^}]+\}/gi) || []).length, 1);
120+
});
109121
});
110122

111123
describe('Styles in src/', () => {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
import styles from "../../styles/duplicate.module.css";
3+
---
4+
<html>
5+
<head>
6+
<title>CSS Module Duplicate Test</title>
7+
</head>
8+
<body>
9+
<div id="duplicate-blue" class={styles['duplicate-blue']}>Blue from front matter</div>
10+
<div id="duplicate-red" class={styles['duplicate-red']}>Red from front matter</div>
11+
</body>
12+
</html>
13+
14+
<script>
15+
import styles from "../../styles/duplicate.module.css";
16+
</script>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.duplicate-blue {
2+
color: blue;
3+
}
4+
5+
.duplicate-red {
6+
color: red;
7+
}

packages/astro/test/i18n-routing.test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,3 +2523,4 @@ describe('i18n routing with server islands and base path', () => {
25232523
assert.equal(serverIslandScript.length, 1, 'has the island script');
25242524
});
25252525
});
2526+
});

packages/astro/test/units/routing/route-matching.test.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,7 @@ describe('Route matching', () => {
143143
});
144144

145145
const loader = createViteLoader(container.viteServer);
146-
const manifest = createDevelopmentManifest(container.settings);
147-
pipeline = DevPipeline.create(undefined, {
148-
loader,
149-
logger: defaultLogger,
150-
manifest,
151-
settings,
152-
getDebugInfo: async () => '',
153-
});
146+
manifest = await createDevelopmentManifest(container.settings);
154147
manifestData = await createRoutesList(
155148
{
156149
cwd: fixture.path,

packages/astro/test/units/vite-plugin-astro-server/request.test.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,6 @@ import {
99
defaultLogger,
1010
} from '../test-utils.js';
1111

12-
async function createDevPipeline(overrides = {}, root) {
13-
const settings = overrides.settings ?? (await createBasicSettings({ root }));
14-
const loader = overrides.loader ?? createLoader();
15-
const manifest = createDevelopmentManifest(settings);
16-
const routesList = await createRoutesList(
17-
{
18-
cwd: root,
19-
settings: settings,
20-
},
21-
defaultLogger,
22-
);
23-
return DevPipeline.create(routesList, {
24-
loader,
25-
logger: defaultLogger,
26-
manifest,
27-
settings,
28-
getDebugInfo: async () => '',
29-
});
30-
}
31-
3212
describe('vite-plugin-astro-server', () => {
3313
describe('url', () => {
3414
let container;

0 commit comments

Comments
 (0)