@mui/internal-code-infra 0.0.4-canary.67 → 0.0.4-canary.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,13 +35,9 @@ describe('createPackageExports', () => {
35
35
  './feature': './src/feature.ts',
36
36
  },
37
37
  {
38
- bundles: [
39
- { type: 'cjs', dir: '.' },
40
- { type: 'esm', dir: '.' },
41
- ],
38
+ bundles: ['cjs', 'esm'],
42
39
  outputDir,
43
40
  cwd,
44
- isFlat: true,
45
41
  packageType: 'module',
46
42
  },
47
43
  );
@@ -60,12 +56,9 @@ describe('createPackageExports', () => {
60
56
  const cwd = await makeTempDir();
61
57
  const outputDir = path.join(cwd, 'build');
62
58
  /**
63
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
59
+ * @type {import('./build.mjs').BundleType[]}
64
60
  */
65
- const bundles = [
66
- { type: 'esm', dir: '.' },
67
- { type: 'cjs', dir: '.' },
68
- ];
61
+ const bundles = ['esm', 'cjs'];
69
62
 
70
63
  await Promise.all([
71
64
  createFile(path.join(cwd, 'src/index.ts')),
@@ -98,7 +91,6 @@ describe('createPackageExports', () => {
98
91
  outputDir,
99
92
  cwd,
100
93
  addTypes: true,
101
- isFlat: true,
102
94
  packageType: 'module',
103
95
  },
104
96
  );
@@ -137,7 +129,6 @@ describe('createPackageExports', () => {
137
129
  outputDir,
138
130
  cwd,
139
131
  addTypes: true,
140
- isFlat: true,
141
132
  },
142
133
  );
143
134
 
@@ -165,12 +156,9 @@ describe('createPackageExports', () => {
165
156
  const cwd = await makeTempDir();
166
157
  const outputDir = path.join(cwd, 'build');
167
158
  /**
168
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
159
+ * @type {import('./build.mjs').BundleType[]}
169
160
  */
170
- const bundles = [
171
- { type: 'esm', dir: '.' },
172
- { type: 'cjs', dir: '.' },
173
- ];
161
+ const bundles = ['esm', 'cjs'];
174
162
 
175
163
  await Promise.all([
176
164
  createFile(path.join(cwd, 'src/Button.ts')),
@@ -196,7 +184,6 @@ describe('createPackageExports', () => {
196
184
  outputDir,
197
185
  cwd,
198
186
  addTypes: true,
199
- isFlat: true,
200
187
  packageType: 'module',
201
188
  },
202
189
  );
@@ -219,12 +206,9 @@ describe('createPackageExports', () => {
219
206
  const cwd = await makeTempDir();
220
207
  const outputDir = path.join(cwd, 'build');
221
208
  /**
222
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
209
+ * @type {import('./build.mjs').BundleType[]}
223
210
  */
224
- const bundles = [
225
- { type: 'esm', dir: '.' },
226
- { type: 'cjs', dir: '.' },
227
- ];
211
+ const bundles = ['esm', 'cjs'];
228
212
 
229
213
  await Promise.all([
230
214
  createFile(path.join(cwd, 'src/Button.ts')),
@@ -244,7 +228,6 @@ describe('createPackageExports', () => {
244
228
  outputDir,
245
229
  cwd,
246
230
  addTypes: true,
247
- isFlat: true,
248
231
  packageType: 'commonjs',
249
232
  },
250
233
  );
@@ -272,11 +255,10 @@ describe('createPackageExports', () => {
272
255
  './*': './src/*.ts',
273
256
  },
274
257
  {
275
- bundles: [{ type: 'cjs', dir: '.' }],
258
+ bundles: ['cjs'],
276
259
  outputDir,
277
260
  cwd,
278
261
  addTypes: true,
279
- isFlat: true,
280
262
  packageType: 'commonjs',
281
263
  },
282
264
  );
@@ -291,12 +273,9 @@ describe('createPackageExports', () => {
291
273
  const cwd = await makeTempDir();
292
274
  const outputDir = path.join(cwd, 'build');
293
275
  /**
294
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
276
+ * @type {import('./build.mjs').BundleType[]}
295
277
  */
296
- const bundles = [
297
- { type: 'esm', dir: '.' },
298
- { type: 'cjs', dir: '.' },
299
- ];
278
+ const bundles = ['esm', 'cjs'];
300
279
 
301
280
  await Promise.all([
302
281
  createFile(path.join(cwd, 'src/Alert.ts')),
@@ -311,7 +290,6 @@ describe('createPackageExports', () => {
311
290
  bundles,
312
291
  outputDir,
313
292
  cwd,
314
- isFlat: true,
315
293
  packageType: 'module',
316
294
  },
317
295
  );
@@ -336,12 +314,9 @@ describe('createPackageExports', () => {
336
314
  const cwd = await makeTempDir();
337
315
  const outputDir = path.join(cwd, 'build');
338
316
  /**
339
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
317
+ * @type {import('./build.mjs').BundleType[]}
340
318
  */
341
- const bundles = [
342
- { type: 'esm', dir: '.' },
343
- { type: 'cjs', dir: '.' },
344
- ];
319
+ const bundles = ['esm', 'cjs'];
345
320
 
346
321
  await Promise.all([
347
322
  createFile(path.join(cwd, 'src/Alert.ts')),
@@ -358,7 +333,6 @@ describe('createPackageExports', () => {
358
333
  bundles,
359
334
  outputDir,
360
335
  cwd,
361
- isFlat: true,
362
336
  packageType: 'module',
363
337
  },
364
338
  );
@@ -393,10 +367,9 @@ describe('createPackageExports', () => {
393
367
  './*': './src/*/script.ts',
394
368
  },
395
369
  {
396
- bundles: [{ type: 'cjs', dir: '.' }],
370
+ bundles: ['cjs'],
397
371
  outputDir,
398
372
  cwd,
399
- isFlat: true,
400
373
  },
401
374
  );
402
375
 
@@ -422,10 +395,9 @@ describe('createPackageExports', () => {
422
395
  './*': './src/*.ts',
423
396
  },
424
397
  {
425
- bundles: [{ type: 'cjs', dir: '.' }],
398
+ bundles: ['cjs'],
426
399
  outputDir,
427
400
  cwd,
428
- isFlat: true,
429
401
  },
430
402
  );
431
403
 
@@ -440,12 +412,9 @@ describe('createPackageExports', () => {
440
412
  const cwd = await makeTempDir();
441
413
  const outputDir = path.join(cwd, 'build');
442
414
  /**
443
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
415
+ * @type {import('./build.mjs').BundleType[]}
444
416
  */
445
- const bundles = [
446
- { type: 'esm', dir: '.' },
447
- { type: 'cjs', dir: '.' },
448
- ];
417
+ const bundles = ['esm', 'cjs'];
449
418
 
450
419
  await Promise.all([
451
420
  createFile(path.join(cwd, 'src/index.ts')),
@@ -466,7 +435,6 @@ describe('createPackageExports', () => {
466
435
  bundles,
467
436
  outputDir,
468
437
  cwd,
469
- isFlat: true,
470
438
  packageType: 'module',
471
439
  },
472
440
  );
@@ -485,12 +453,9 @@ describe('createPackageExports', () => {
485
453
  const cwd = await makeTempDir();
486
454
  const outputDir = path.join(cwd, 'build');
487
455
  /**
488
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
456
+ * @type {import('./build.mjs').BundleType[]}
489
457
  */
490
- const bundles = [
491
- { type: 'esm', dir: '.' },
492
- { type: 'cjs', dir: '.' },
493
- ];
458
+ const bundles = ['esm', 'cjs'];
494
459
 
495
460
  await Promise.all([
496
461
  createFile(path.join(cwd, 'src/utils/color.ts')),
@@ -510,7 +475,6 @@ describe('createPackageExports', () => {
510
475
  bundles,
511
476
  outputDir,
512
477
  cwd,
513
- isFlat: true,
514
478
  packageType: 'module',
515
479
  },
516
480
  );
@@ -539,10 +503,9 @@ describe('createPackageExports', () => {
539
503
  './*': './src/*.ts',
540
504
  },
541
505
  {
542
- bundles: [{ type: 'cjs', dir: '.' }],
506
+ bundles: ['cjs'],
543
507
  outputDir,
544
508
  cwd,
545
- isFlat: true,
546
509
  },
547
510
  );
548
511
 
@@ -569,10 +532,9 @@ describe('createPackageExports', () => {
569
532
  './*': './src/*.ts',
570
533
  },
571
534
  {
572
- bundles: [{ type: 'cjs', dir: '.' }],
535
+ bundles: ['cjs'],
573
536
  outputDir,
574
537
  cwd,
575
- isFlat: true,
576
538
  },
577
539
  );
578
540
 
@@ -584,12 +546,9 @@ describe('createPackageExports', () => {
584
546
  const cwd = await makeTempDir();
585
547
  const outputDir = path.join(cwd, 'build');
586
548
  /**
587
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
549
+ * @type {import('./build.mjs').BundleType[]}
588
550
  */
589
- const bundles = [
590
- { type: 'esm', dir: '.' },
591
- { type: 'cjs', dir: '.' },
592
- ];
551
+ const bundles = ['esm', 'cjs'];
593
552
 
594
553
  await Promise.all([
595
554
  createFile(path.join(cwd, 'src/Accordion.ts')),
@@ -613,7 +572,6 @@ describe('createPackageExports', () => {
613
572
  bundles,
614
573
  outputDir,
615
574
  cwd,
616
- isFlat: true,
617
575
  packageType: 'module',
618
576
  },
619
577
  );
@@ -645,10 +603,9 @@ describe('createPackageExports', () => {
645
603
  './Alert*': null,
646
604
  },
647
605
  {
648
- bundles: [{ type: 'cjs', dir: '.' }],
606
+ bundles: ['cjs'],
649
607
  outputDir,
650
608
  cwd,
651
- isFlat: true,
652
609
  },
653
610
  );
654
611
 
@@ -671,10 +628,9 @@ describe('createPackageExports', () => {
671
628
  './internal/*': null,
672
629
  },
673
630
  {
674
- bundles: [{ type: 'cjs', dir: '.' }],
631
+ bundles: ['cjs'],
675
632
  outputDir,
676
633
  cwd,
677
- isFlat: true,
678
634
  },
679
635
  );
680
636
 
@@ -698,10 +654,9 @@ describe('createPackageExports', () => {
698
654
  './*': './src/*.ts',
699
655
  },
700
656
  {
701
- bundles: [{ type: 'cjs', dir: '.' }],
657
+ bundles: ['cjs'],
702
658
  outputDir,
703
659
  cwd,
704
- isFlat: false,
705
660
  expand: false,
706
661
  },
707
662
  );
@@ -730,10 +685,9 @@ describe('createPackageExports', () => {
730
685
  './*': './src/index.ts',
731
686
  },
732
687
  {
733
- bundles: [{ type: 'cjs', dir: '.' }],
688
+ bundles: ['cjs'],
734
689
  outputDir,
735
690
  cwd,
736
- isFlat: true,
737
691
  },
738
692
  );
739
693
 
@@ -757,11 +711,10 @@ describe('createPackageExports', () => {
757
711
  '.': './src/index.ts',
758
712
  },
759
713
  {
760
- bundles: [{ type: 'cjs', dir: '.' }],
714
+ bundles: ['cjs'],
761
715
  outputDir,
762
716
  cwd,
763
717
  addTypes: true,
764
- isFlat: true,
765
718
  packageType: 'commonjs',
766
719
  },
767
720
  );
@@ -785,12 +738,9 @@ describe('createPackageExports leaf rewriting', () => {
785
738
  const cwd = await makeTempDir();
786
739
  const outputDir = path.join(cwd, 'build');
787
740
  /**
788
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
741
+ * @type {import('./build.mjs').BundleType[]}
789
742
  */
790
- const bundles = [
791
- { type: 'esm', dir: '.' },
792
- { type: 'cjs', dir: '.' },
793
- ];
743
+ const bundles = ['esm', 'cjs'];
794
744
 
795
745
  await Promise.all([
796
746
  createFile(path.join(cwd, 'src/feature.ts')),
@@ -805,7 +755,6 @@ describe('createPackageExports leaf rewriting', () => {
805
755
  bundles,
806
756
  outputDir,
807
757
  cwd,
808
- isFlat: true,
809
758
  packageType: 'module',
810
759
  },
811
760
  );
@@ -839,10 +788,9 @@ describe('createPackageExports leaf rewriting', () => {
839
788
  './legacy': './vendor/legacy.js',
840
789
  },
841
790
  {
842
- bundles: [{ type: 'cjs', dir: '.' }],
791
+ bundles: ['cjs'],
843
792
  outputDir,
844
793
  cwd,
845
- isFlat: true,
846
794
  },
847
795
  );
848
796
 
@@ -862,10 +810,9 @@ describe('createPackageExports leaf rewriting', () => {
862
810
  './entry': 'src/index.ts',
863
811
  },
864
812
  {
865
- bundles: [{ type: 'cjs', dir: '.' }],
813
+ bundles: ['cjs'],
866
814
  outputDir,
867
815
  cwd,
868
- isFlat: true,
869
816
  },
870
817
  );
871
818
 
@@ -886,10 +833,9 @@ describe('createPackageExports leaf rewriting', () => {
886
833
  './theme.css': './src/theme.css',
887
834
  },
888
835
  {
889
- bundles: [{ type: 'cjs', dir: '.' }],
836
+ bundles: ['cjs'],
890
837
  outputDir,
891
838
  cwd,
892
- isFlat: true,
893
839
  },
894
840
  );
895
841
 
@@ -900,12 +846,9 @@ describe('createPackageExports leaf rewriting', () => {
900
846
  const cwd = await makeTempDir();
901
847
  const outputDir = path.join(cwd, 'build');
902
848
  /**
903
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
849
+ * @type {import('./build.mjs').BundleType[]}
904
850
  */
905
- const bundles = [
906
- { type: 'esm', dir: '.' },
907
- { type: 'cjs', dir: '.' },
908
- ];
851
+ const bundles = ['esm', 'cjs'];
909
852
 
910
853
  await Promise.all([
911
854
  createFile(path.join(cwd, 'src/esm.ts')),
@@ -920,7 +863,6 @@ describe('createPackageExports leaf rewriting', () => {
920
863
  bundles,
921
864
  outputDir,
922
865
  cwd,
923
- isFlat: true,
924
866
  packageType: 'module',
925
867
  },
926
868
  );
@@ -957,10 +899,9 @@ describe('createPackageExports resolution semantics', () => {
957
899
  await seedWorkedExample(cwd);
958
900
 
959
901
  const { exports: packageExports } = await createPackageExports(workedExampleExports, {
960
- bundles: [{ type: 'cjs', dir: '.' }],
902
+ bundles: ['cjs'],
961
903
  outputDir,
962
904
  cwd,
963
- isFlat: true,
964
905
  });
965
906
 
966
907
  // ./foo/x resolves (matched only by the shallow pattern)
@@ -985,10 +926,9 @@ describe('createPackageExports resolution semantics', () => {
985
926
  await seedWorkedExample(cwd);
986
927
 
987
928
  const { exports: packageExports } = await createPackageExports(workedExampleExports, {
988
- bundles: [{ type: 'cjs', dir: '.' }],
929
+ bundles: ['cjs'],
989
930
  outputDir,
990
931
  cwd,
991
- isFlat: true,
992
932
  expand: false,
993
933
  });
994
934
 
@@ -1019,10 +959,9 @@ describe('createPackageExports resolution semantics', () => {
1019
959
  './*': './src/*.ts',
1020
960
  },
1021
961
  {
1022
- bundles: [{ type: 'cjs', dir: '.' }],
962
+ bundles: ['cjs'],
1023
963
  outputDir,
1024
964
  cwd,
1025
- isFlat: true,
1026
965
  },
1027
966
  );
1028
967
 
@@ -1043,19 +982,15 @@ describe('createPackageBin', () => {
1043
982
  it('prefers the ESM bundle when available', async () => {
1044
983
  const cwd = await makeTempDir();
1045
984
  /**
1046
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
985
+ * @type {import('./build.mjs').BundleType[]}
1047
986
  */
1048
- const bundles = [
1049
- { type: 'esm', dir: '.' },
1050
- { type: 'cjs', dir: '.' },
1051
- ];
987
+ const bundles = ['esm', 'cjs'];
1052
988
 
1053
989
  await Promise.all([createFile(path.join(cwd, 'src/cli.ts'))]);
1054
990
 
1055
991
  let bin = await createPackageBin('./src/cli.ts', {
1056
992
  bundles,
1057
993
  cwd,
1058
- isFlat: true,
1059
994
  packageType: 'module',
1060
995
  });
1061
996
 
@@ -1064,7 +999,6 @@ describe('createPackageBin', () => {
1064
999
  bin = await createPackageBin('./src/cli.ts', {
1065
1000
  bundles: [bundles[1]], // only CJS bundle
1066
1001
  cwd,
1067
- isFlat: true,
1068
1002
  });
1069
1003
 
1070
1004
  expect(bin).toBe('./cli.js');
@@ -1072,7 +1006,6 @@ describe('createPackageBin', () => {
1072
1006
  bin = await createPackageBin('./src/cli.ts', {
1073
1007
  bundles, // only CJS bundle
1074
1008
  cwd,
1075
- isFlat: true,
1076
1009
  packageType: 'commonjs',
1077
1010
  });
1078
1011
 
@@ -1085,9 +1018,8 @@ describe('createPackageImports', () => {
1085
1018
  const cwd = await makeTempDir();
1086
1019
 
1087
1020
  const imports = await createPackageImports(undefined, {
1088
- bundles: [{ type: 'esm', dir: '.' }],
1021
+ bundles: ['esm'],
1089
1022
  cwd,
1090
- isFlat: true,
1091
1023
  packageType: 'module',
1092
1024
  });
1093
1025
 
@@ -1103,9 +1035,8 @@ describe('createPackageImports', () => {
1103
1035
  'internal/utils': './src/internal/utils.ts',
1104
1036
  }),
1105
1037
  {
1106
- bundles: [{ type: 'esm', dir: '.' }],
1038
+ bundles: ['esm'],
1107
1039
  cwd,
1108
- isFlat: true,
1109
1040
  packageType: 'module',
1110
1041
  },
1111
1042
  ),
@@ -1116,12 +1047,9 @@ describe('createPackageImports', () => {
1116
1047
  const cwd = await makeTempDir();
1117
1048
  const outputDir = path.join(cwd, 'build');
1118
1049
  /**
1119
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
1050
+ * @type {import('./build.mjs').BundleType[]}
1120
1051
  */
1121
- const bundles = [
1122
- { type: 'esm', dir: '.' },
1123
- { type: 'cjs', dir: '.' },
1124
- ];
1052
+ const bundles = ['esm', 'cjs'];
1125
1053
 
1126
1054
  await Promise.all([
1127
1055
  createFile(path.join(cwd, 'src/internal/utils.ts')),
@@ -1139,7 +1067,6 @@ describe('createPackageImports', () => {
1139
1067
  bundles,
1140
1068
  cwd,
1141
1069
  addTypes: true,
1142
- isFlat: true,
1143
1070
  packageType: 'module',
1144
1071
  },
1145
1072
  );
@@ -1169,12 +1096,8 @@ describe('createPackageImports', () => {
1169
1096
  },
1170
1097
  {
1171
1098
  // Pass cjs before esm to verify the key order is still 'import' then 'require'
1172
- bundles: [
1173
- { type: 'cjs', dir: '.' },
1174
- { type: 'esm', dir: '.' },
1175
- ],
1099
+ bundles: ['cjs', 'esm'],
1176
1100
  cwd,
1177
- isFlat: true,
1178
1101
  packageType: 'module',
1179
1102
  },
1180
1103
  );
@@ -1192,12 +1115,8 @@ describe('createPackageImports', () => {
1192
1115
  '#error-formatter': '@custom/error-formatter',
1193
1116
  },
1194
1117
  {
1195
- bundles: [
1196
- { type: 'esm', dir: '.' },
1197
- { type: 'cjs', dir: '.' },
1198
- ],
1118
+ bundles: ['esm', 'cjs'],
1199
1119
  cwd,
1200
- isFlat: true,
1201
1120
  packageType: 'module',
1202
1121
  },
1203
1122
  );
@@ -1223,9 +1142,8 @@ describe('createPackageImports', () => {
1223
1142
  '#internal/*': './src/internal/*.ts',
1224
1143
  },
1225
1144
  {
1226
- bundles: [{ type: 'esm', dir: '.' }],
1145
+ bundles: ['esm'],
1227
1146
  cwd,
1228
- isFlat: true,
1229
1147
  packageType: 'module',
1230
1148
  },
1231
1149
  );
@@ -1239,12 +1157,9 @@ describe('createPackageImports', () => {
1239
1157
  it('rewrites every condition of a conditions object (conditions-outer)', async () => {
1240
1158
  const cwd = await makeTempDir();
1241
1159
  /**
1242
- * @type {{ type: import('./build.mjs').BundleType; dir: string }[]}
1160
+ * @type {import('./build.mjs').BundleType[]}
1243
1161
  */
1244
- const bundles = [
1245
- { type: 'esm', dir: '.' },
1246
- { type: 'cjs', dir: '.' },
1247
- ];
1162
+ const bundles = ['esm', 'cjs'];
1248
1163
 
1249
1164
  await Promise.all([
1250
1165
  createFile(path.join(cwd, 'src/internal/utils.ts')),
@@ -1261,7 +1176,6 @@ describe('createPackageImports', () => {
1261
1176
  {
1262
1177
  bundles,
1263
1178
  cwd,
1264
- isFlat: true,
1265
1179
  packageType: 'module',
1266
1180
  },
1267
1181
  );
@@ -1294,12 +1208,8 @@ describe('createPackageImports', () => {
1294
1208
  },
1295
1209
  },
1296
1210
  {
1297
- bundles: [
1298
- { type: 'esm', dir: '.' },
1299
- { type: 'cjs', dir: '.' },
1300
- ],
1211
+ bundles: ['esm', 'cjs'],
1301
1212
  cwd,
1302
- isFlat: true,
1303
1213
  packageType: 'module',
1304
1214
  },
1305
1215
  );
@@ -1333,12 +1243,8 @@ describe('createPackageImports', () => {
1333
1243
  },
1334
1244
  },
1335
1245
  {
1336
- bundles: [
1337
- { type: 'esm', dir: '.' },
1338
- { type: 'cjs', dir: '.' },
1339
- ],
1246
+ bundles: ['esm', 'cjs'],
1340
1247
  cwd,
1341
- isFlat: true,
1342
1248
  packageType: 'module',
1343
1249
  },
1344
1250
  );