Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use index as entry name #104

Merged
merged 3 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/cases/alias/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
alias: {
'@src': 'src',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
source: {
entry: {
main: '../../__fixtures__/src/index.ts',
index: '../../__fixtures__/src/index.ts',
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
source: {
entry: {
main: '../../__fixtures__/src/index.ts',
index: '../../__fixtures__/src/index.ts',
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
source: {
entry: {
main: '../../__fixtures__/src/index.ts',
index: '../../__fixtures__/src/index.ts',
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/auto-extension/type-module/false/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
source: {
entry: {
main: '../../__fixtures__/src/index.ts',
index: '../../__fixtures__/src/index.ts',
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/auto-external/default/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineConfig({
],
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/auto-external/external-sub-path/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/auto-external/false/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default defineConfig({
],
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/auto-external/with-externals/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineConfig({
},
source: {
entry: {
main: '../__fixtures__/src/index.ts',
index: '../__fixtures__/src/index.ts',
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/bundle-false/basic/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
source: {
entry: {
main: ['./src/**'],
index: ['./src/**'],
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/bundle-false/relative-import/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
source: {
entry: {
main: ['./src/**'],
index: ['./src/**'],
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/bundle-false/single-file/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
source: {
entry: {
main: ['./src/**'],
index: ['./src/**'],
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/define/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
define: {
VERSION: JSON.stringify('1.0.0'),
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle-false/abort-on-error/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineConfig({
],
source: {
entry: {
main: ['./src/**'],
index: ['./src/**'],
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle-false/auto-extension/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineConfig({
],
source: {
entry: {
main: ['../__fixtures__/src/**'],
index: ['../__fixtures__/src/**'],
},
tsconfigPath: '../__fixtures__/tsconfig.json',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle-false/basic/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default defineConfig({
],
source: {
entry: {
main: ['../__fixtures__/src/**'],
index: ['../__fixtures__/src/**'],
},
tsconfigPath: '../__fixtures__/tsconfig.json',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle-false/dist-path/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineConfig({
],
source: {
entry: {
main: ['../__fixtures__/src/**'],
index: ['../__fixtures__/src/**'],
},
tsconfigPath: '../__fixtures__/tsconfig.json',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle-false/false/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
],
source: {
entry: {
main: ['../__fixtures__/src/**'],
index: ['../__fixtures__/src/**'],
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle/abort-on-error/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
],
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
tsconfigPath: 'tsconfig.json',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle/auto-extension/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
source: {
entry: {
main: '../__fixtures__/src/index.ts',
index: '../__fixtures__/src/index.ts',
},
tsconfigPath: '../__fixtures__/tsconfig.json',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle/basic/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default defineConfig({
],
source: {
entry: {
main: '../__fixtures__/src/index.ts',
index: '../__fixtures__/src/index.ts',
},
tsconfigPath: '../__fixtures__/tsconfig.json',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle/dist-path/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
],
source: {
entry: {
main: '../__fixtures__/src/index.ts',
index: '../__fixtures__/src/index.ts',
},
tsconfigPath: '../__fixtures__/tsconfig.json',
},
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/dts/bundle/false/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export default defineConfig({
],
source: {
entry: {
main: '../__fixtures__/src/index.ts',
index: '../__fixtures__/src/index.ts',
},
tsconfigPath: '../__fixtures__/tsconfig.json',
},
Expand Down
6 changes: 3 additions & 3 deletions e2e/cases/dts/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('dts when bundle: true', () => {
);

expect(entryFiles.esm).toMatchInlineSnapshot(
`"<ROOT>/e2e/cases/dts/bundle/basic/dist/esm/main.d.ts"`,
`"<ROOT>/e2e/cases/dts/bundle/basic/dist/esm/index.d.ts"`,
);
expect(entries).toMatchSnapshot();
});
Expand All @@ -87,7 +87,7 @@ describe('dts when bundle: true', () => {
const { entryFiles } = await buildAndGetResults(fixturePath, 'dts');

expect(entryFiles.esm).toMatchInlineSnapshot(
`"<ROOT>/e2e/cases/dts/bundle/dist-path/dist/custom/main.d.ts"`,
`"<ROOT>/e2e/cases/dts/bundle/dist-path/dist/custom/index.d.ts"`,
);
});

Expand All @@ -103,7 +103,7 @@ describe('dts when bundle: true', () => {
const { entryFiles } = await buildAndGetResults(fixturePath, 'dts');

expect(entryFiles.cjs).toMatchInlineSnapshot(
`"<ROOT>/e2e/cases/dts/bundle/auto-extension/dist/cjs/main.d.cts"`,
`"<ROOT>/e2e/cases/dts/bundle/auto-extension/dist/cjs/index.d.cts"`,
);
});

Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/externals/browser/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
},
output: {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/externals/node/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
],
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
},
output: {
Expand Down
2 changes: 1 addition & 1 deletion e2e/cases/shims/esm/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
},
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/syntax/config/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default defineConfig({
],
source: {
entry: {
main: '../__fixtures__/src/index.ts',
index: '../__fixtures__/src/index.ts',
},
},
});
2 changes: 1 addition & 1 deletion e2e/cases/syntax/default/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default defineConfig({
lib: [generateBundleEsmConfig(__dirname), generateBundleCjsConfig(__dirname)],
source: {
entry: {
main: '../__fixtures__/src/index.ts',
index: '../__fixtures__/src/index.ts',
},
},
});
3 changes: 2 additions & 1 deletion examples/express-plugin/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ export default defineConfig({
},
},
],
// TODO: We can remove this after https://github.com/web-infra-dev/rsbuild/pull/3225 being released
source: {
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
},
output: {
Expand Down
3 changes: 2 additions & 1 deletion examples/react-component/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ export default defineConfig({
},
},
],
// TODO: We can remove this after https://github.com/web-infra-dev/rsbuild/pull/3225 being released
source: {
entry: {
main: './src/index.tsx',
index: './src/index.tsx',
},
},
plugins: [pluginReact()],
Expand Down
2 changes: 1 addition & 1 deletion packages/core/bin/rslib.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
import { logger, prepareCli, runCli } from '../dist/main.js';
import { logger, prepareCli, runCli } from '../dist/index.js';

async function main() {
prepareCli();
Expand Down
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"exports": {
".": {
"types": "./dist-types/index.d.ts",
"default": "./dist/main.js"
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/main.js",
"main": "./dist/index.js",
"types": "./dist-types/index.d.ts",
"bin": {
"rslib": "./bin/rslib.js"
Expand Down
3 changes: 2 additions & 1 deletion packages/core/rslib.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export default defineConfig({
define: {
RSLIB_VERSION: JSON.stringify(require('./package.json').version),
},
// TODO: We can remove this after https://github.com/web-infra-dev/rsbuild/pull/3225 being released
entry: {
main: './src/index.ts',
index: './src/index.ts',
},
},
output: {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ const composeEntryConfig = async (
const entry = entries[key];

// Entries in bundleless mode could be:
// 1. A string of glob pattern: { entry: { main: 'src/*.ts' } }
// 2. An array of glob patterns: { entry: { main: ['src/*.ts', 'src/*.tsx'] } }
// 1. A string of glob pattern: { entry: { index: 'src/*.ts' } }
// 2. An array of glob patterns: { entry: { index: ['src/*.ts', 'src/*.tsx'] } }
// Not supported for now: entry description object
const entryFiles = Array.isArray(entry)
? entry
Expand Down
Loading
Loading