Skip to content

Commit c3fc11e

Browse files
committed
chore: init basic needs
1 parent 6291f9f commit c3fc11e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+1005
-6
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@import 'https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.1.0/modern-normalize.css';
2+
@import url('https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.1.0/modern-normalize.css');
3+
@import url('lib1.css');
4+
@import 'lib2.css';
5+
6+
.import {
7+
background-image: url('https://cdnjs.cloudflare.com/ajax/libs/modern-normalize/1.1.0/modern-normalize.css');
8+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.lib1 {
2+
color: red;
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.lib2 {
2+
color: green;
3+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "@rslib/tsconfig/base",
3+
"compilerOptions": {
4+
"baseUrl": "./"
5+
},
6+
"include": ["src"]
7+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "css-bundle-false-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module"
6+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
2+
import { defineConfig } from '@rslib/core';
3+
4+
export default defineConfig({
5+
lib: [
6+
generateBundleEsmConfig({ bundle: false }),
7+
generateBundleCjsConfig({ bundle: false }),
8+
],
9+
source: {
10+
entry: {
11+
index: ['../__fixtures__/src/**/*.css'],
12+
},
13+
},
14+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "css-bundle-test",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module"
6+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { generateBundleCjsConfig, generateBundleEsmConfig } from '@e2e/helper';
2+
import { defineConfig } from '@rslib/core';
3+
4+
export default defineConfig({
5+
lib: [generateBundleEsmConfig(), generateBundleCjsConfig()],
6+
source: {
7+
entry: {
8+
index: '../__fixtures__/src/import.css',
9+
},
10+
},
11+
});

e2e/cases/style/css/index.test.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { join } from 'node:path';
2+
import { buildAndGetResults } from '@e2e/helper';
3+
import { expect, test } from 'vitest';
4+
5+
test('should extract css when set bundle: true', async () => {
6+
const fixturePath = join(__dirname, 'bundle');
7+
const { contents } = await buildAndGetResults(fixturePath, 'css');
8+
const esmFiles = Object.keys(contents.esm);
9+
expect(esmFiles).toMatchInlineSnapshot(`
10+
[
11+
"<ROOT>/cases/style/css/bundle/dist/esm/static/css/index.css",
12+
]
13+
`);
14+
15+
const cjsFiles = Object.keys(contents.cjs);
16+
expect(cjsFiles).toMatchInlineSnapshot(`
17+
[
18+
"<ROOT>/cases/style/css/bundle/dist/cjs/static/css/index.css",
19+
]
20+
`);
21+
});
22+
23+
test('should extract css when set bundle: false', async () => {
24+
const fixturePath = join(__dirname, 'bundle-false');
25+
const { contents } = await buildAndGetResults(fixturePath, 'css');
26+
const esmFiles = Object.keys(contents.esm);
27+
28+
expect(esmFiles).toMatchInlineSnapshot(`
29+
[
30+
"<ROOT>/cases/style/css/bundle-false/dist/esm/import.css",
31+
"<ROOT>/cases/style/css/bundle-false/dist/esm/lib1.css",
32+
"<ROOT>/cases/style/css/bundle-false/dist/esm/lib2.css",
33+
]
34+
`);
35+
36+
const cjsFiles = Object.keys(contents.cjs);
37+
expect(cjsFiles).toMatchInlineSnapshot(`
38+
[
39+
"<ROOT>/cases/style/css/bundle-false/dist/cjs/import.css",
40+
"<ROOT>/cases/style/css/bundle-false/dist/cjs/lib1.css",
41+
"<ROOT>/cases/style/css/bundle-false/dist/cjs/lib2.css",
42+
]
43+
`);
44+
});
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!node_modules
2+
node_modules/.*

0 commit comments

Comments
 (0)