Skip to content

Commit 84b3956

Browse files
committed
chore: update
1 parent a3228fc commit 84b3956

File tree

10 files changed

+49
-28
lines changed

10 files changed

+49
-28
lines changed

packages/core/tests/__snapshots__/config.test.ts.snap

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
311311
experiments: {
312312
lazyBarrel: true,
313313
inlineEnum: true,
314+
inlineConst: true,
314315
typeReexportsPresence: true,
315316
rspackFuture: {
316317
bundlerInfo: {
@@ -455,6 +456,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
455456
module: {
456457
parser: {
457458
javascript: {
459+
inlineConst: true,
458460
exportsPresence: 'error',
459461
typeReexportsPresence: 'tolerant',
460462
importMeta: false,
@@ -1009,6 +1011,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
10091011
experiments: {
10101012
lazyBarrel: true,
10111013
inlineEnum: true,
1014+
inlineConst: true,
10121015
typeReexportsPresence: true,
10131016
rspackFuture: {
10141017
bundlerInfo: {
@@ -1151,6 +1154,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
11511154
module: {
11521155
parser: {
11531156
javascript: {
1157+
inlineConst: true,
11541158
exportsPresence: 'error',
11551159
typeReexportsPresence: 'tolerant',
11561160
importMeta: false,
@@ -1701,6 +1705,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
17011705
experiments: {
17021706
lazyBarrel: true,
17031707
inlineEnum: true,
1708+
inlineConst: true,
17041709
typeReexportsPresence: true,
17051710
rspackFuture: {
17061711
bundlerInfo: {
@@ -1830,6 +1835,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
18301835
module: {
18311836
parser: {
18321837
javascript: {
1838+
inlineConst: true,
18331839
exportsPresence: 'error',
18341840
typeReexportsPresence: 'tolerant',
18351841
importMeta: false
@@ -2299,6 +2305,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
22992305
experiments: {
23002306
lazyBarrel: true,
23012307
inlineEnum: true,
2308+
inlineConst: true,
23022309
typeReexportsPresence: true,
23032310
rspackFuture: {
23042311
bundlerInfo: {
@@ -2430,6 +2437,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
24302437
module: {
24312438
parser: {
24322439
javascript: {
2440+
inlineConst: true,
24332441
exportsPresence: 'error',
24342442
typeReexportsPresence: 'tolerant',
24352443
importMeta: false
@@ -2898,6 +2906,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
28982906
experiments: {
28992907
lazyBarrel: true,
29002908
inlineEnum: true,
2909+
inlineConst: true,
29012910
typeReexportsPresence: true,
29022911
rspackFuture: {
29032912
bundlerInfo: {
@@ -2966,6 +2975,7 @@ exports[`Should compose create Rsbuild config correctly > Merge Rsbuild config i
29662975
module: {
29672976
parser: {
29682977
javascript: {
2978+
inlineConst: true,
29692979
exportsPresence: 'error',
29702980
typeReexportsPresence: 'tolerant'
29712981
}

rslint.jsonc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"@typescript-eslint/no-misused-promises": "off",
2828
"@typescript-eslint/no-redundant-type-constituents": "off",
2929
"@typescript-eslint/switch-exhaustiveness-check": "off",
30+
"@typescript-eslint/no-explicit-any": "off",
3031
},
3132
},
3233
]

tests/integration/auto-extension/index.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ describe('should respect output.filename.js and output.filenameHash to override
4646
// override output.filename.js
4747
expect(extname(entryFiles.esm0!)).toEqual('.mjs');
4848
expect(entryFiles.cjs0).toMatchInlineSnapshot(
49-
`"<ROOT>/tests/integration/auto-extension/type-commonjs/config-override/dist/cjs-override-filename/index.df02628a.js"`,
49+
`"<ROOT>/tests/integration/auto-extension/type-commonjs/config-override/dist/cjs-override-filename/index.c8a12fd0.js"`,
5050
);
5151

5252
// override output.filenameHash
5353
expect(entryFiles.esm1).toMatchInlineSnapshot(
54-
`"<ROOT>/tests/integration/auto-extension/type-commonjs/config-override/dist/esm-override-filename-hash/index.996a7edd.js"`,
54+
`"<ROOT>/tests/integration/auto-extension/type-commonjs/config-override/dist/esm-override-filename-hash/index.b4545719.js"`,
5555
);
5656
expect(entryFiles.cjs1).toMatchInlineSnapshot(
57-
`"<ROOT>/tests/integration/auto-extension/type-commonjs/config-override/dist/cjs-override-filename-hash/index.df02628a.js"`,
57+
`"<ROOT>/tests/integration/auto-extension/type-commonjs/config-override/dist/cjs-override-filename-hash/index.c8a12fd0.js"`,
5858
);
5959

6060
// override different file types with function
@@ -80,16 +80,16 @@ describe('should respect output.filename.js and output.filenameHash to override
8080

8181
// override output.filename.js
8282
expect(entryFiles.esm0).toMatchInlineSnapshot(
83-
`"<ROOT>/tests/integration/auto-extension/type-module/config-override/dist/esm-override-filename/index.996a7edd.js"`,
83+
`"<ROOT>/tests/integration/auto-extension/type-module/config-override/dist/esm-override-filename/index.b4545719.js"`,
8484
);
8585
expect(extname(entryFiles.cjs0!)).toEqual('.cjs');
8686

8787
// override output.filenameHash
8888
expect(entryFiles.esm1).toMatchInlineSnapshot(
89-
`"<ROOT>/tests/integration/auto-extension/type-module/config-override/dist/esm-override-filename-hash/index.996a7edd.js"`,
89+
`"<ROOT>/tests/integration/auto-extension/type-module/config-override/dist/esm-override-filename-hash/index.b4545719.js"`,
9090
);
9191
expect(entryFiles.cjs1).toMatchInlineSnapshot(
92-
`"<ROOT>/tests/integration/auto-extension/type-module/config-override/dist/cjs-override-filename-hash/index.df02628a.js"`,
92+
`"<ROOT>/tests/integration/auto-extension/type-module/config-override/dist/cjs-override-filename-hash/index.c8a12fd0.js"`,
9393
);
9494

9595
// override different file types with function

tests/integration/entry/index.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,25 @@ test('multiple entry bundle', async () => {
6565
const { content: index } = queryContent(contents.esm, 'index.js', {
6666
basename: true,
6767
});
68+
// cspell:disable
6869
expect(index).toMatchInlineSnapshot(`
69-
"const shared = 'shared';
70-
const foo = 'foo' + shared;
71-
const src_text = ()=>\`hello \${foo} \${shared}\`;
70+
"const foo = "fooshared";
71+
const src_text = ()=>\`hello \${foo} shared\`;
7272
export { src_text as text };
7373
"
7474
`);
75+
// cspell:enable
7576

7677
const { content: foo } = queryContent(contents.esm, 'foo.js', {
7778
basename: true,
7879
});
80+
// cspell:disable
7981
expect(foo).toMatchInlineSnapshot(`
80-
"const shared = 'shared';
81-
const foo = 'foo' + shared;
82+
"const foo = "fooshared";
8283
export { foo };
8384
"
8485
`);
86+
// cspell:enable
8587

8688
const { content: shared } = queryContent(contents.esm, 'shared.js', {
8789
basename: true,

tests/integration/extension-alias/__snapshots__/index.test.ts.snap

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22

33
exports[`resolve.extensionAlias should work 1`] = `
44
""use strict";
5+
var __webpack_require__ = {};
6+
(()=>{
7+
__webpack_require__.r = (exports1)=>{
8+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
9+
value: 'Module'
10+
});
11+
Object.defineProperty(exports1, '__esModule', {
12+
value: true
13+
});
14+
};
15+
})();
516
var __webpack_exports__ = {};
6-
const bar = 'bar';
7-
const foo = 'foo';
8-
console.log(foo + bar);
17+
__webpack_require__.r(__webpack_exports__);
18+
console.log("foobar");
919
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
1020
Object.defineProperty(exports, '__esModule', {
1121
value: true
@@ -14,8 +24,6 @@ Object.defineProperty(exports, '__esModule', {
1424
`;
1525

1626
exports[`resolve.extensionAlias should work 2`] = `
17-
"const bar = 'bar';
18-
const foo = 'foo';
19-
console.log(foo + bar);
27+
"console.log("foobar");
2028
"
2129
`;

tests/integration/externals/index.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ test('user externals', async () => {
9696
"import node_fs from "node:fs";
9797
import lodash from "lodash";
9898
import zip from "lodash/zip";
99-
const foo = 'foo';
100-
console.log(node_fs, lodash.add, zip, foo);
99+
console.log(node_fs, lodash.add, zip, "foo");
101100
"
102101
`,
103102
);

tests/integration/format/index.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ test('format default to esm', async () => {
2727
}
2828
`);
2929

30+
// cspell:disable
3031
expect(contents.esm0).toMatchInlineSnapshot(`
3132
{
32-
"<ROOT>/tests/integration/format/default/dist/bundle-esm/index.js": "const foo = 'foo';
33-
const str = 'hello' + foo + ' world';
33+
"<ROOT>/tests/integration/format/default/dist/bundle-esm/index.js": "const str = "hellofoo world";
3434
export { str };
3535
",
3636
}
3737
`);
38+
// cspell:enable
3839

3940
expect(contents.esm1).toMatchInlineSnapshot(`
4041
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const i1 = import(`${process.env.DIR}./other`);
22
const i2 = import(process.env.DIR!);
3-
const condition = 1 > 0;
3+
const condition = process.env.CONDITION === '1';
44
const i3 = import(condition ? './other1' : './other2');
55
export { i1, i2, i3 };

tests/integration/resolve/index.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ test('resolve with js extensions', async () => {
6363

6464
expect(isSuccess).toBeTruthy();
6565
expect(entries.esm).toMatchInlineSnapshot(`
66-
"const value = 1;
67-
console.log(value);
66+
"console.log(1);
6867
"
6968
`);
7069
});
@@ -76,8 +75,7 @@ test('resolve with main fields', async () => {
7675

7776
expect(isSuccess).toBeTruthy();
7877
expect(Object.values(results[0]!)[0]).toMatchInlineSnapshot(`
79-
"const value = 1;
80-
console.log(value);
78+
"console.log(1);
8179
"
8280
`);
8381
expect(Object.values(results[1]!)[0]).toContain('main');

tests/integration/tsconfig/index.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ test('tsconfig path', async () => {
66
const { isSuccess, entries } = await buildAndGetResults({ fixturePath });
77

88
expect(isSuccess).toBe(true);
9-
expect(entries.esm).toContain(`const foo = 'foo'`);
10-
expect(entries.cjs).toContain(`const foo = 'foo'`);
9+
expect(entries.esm).toContain(`console.info("foo");
10+
`);
11+
expect(entries.cjs).toContain(`console.info("foo");
12+
`);
1113
});

0 commit comments

Comments
 (0)