Skip to content

Commit 0e12657

Browse files
committed
fix bugs due to lack of file-private vars in go
1 parent cd3fdcc commit 0e12657

9 files changed

+2257
-2257
lines changed

internal/bundler/bundler_default_test.go

+42-42
Original file line numberDiff line numberDiff line change
@@ -5415,7 +5415,7 @@ fragment.jsx: WARNING: "import.meta" is not available in the configured target e
54155415
}
54165416

54175417
func TestBundlingFilesOutsideOfOutbase(t *testing.T) {
5418-
splitting_suite.expectBundled(t, bundled{
5418+
default_suite.expectBundled(t, bundled{
54195419
files: map[string]string{
54205420
"/src/entry.js": `
54215421
console.log('test')
@@ -5510,7 +5510,7 @@ var relocateEntries = []string{
55105510
}
55115511

55125512
func TestVarRelocatingBundle(t *testing.T) {
5513-
splitting_suite.expectBundled(t, bundled{
5513+
default_suite.expectBundled(t, bundled{
55145514
files: relocateFiles,
55155515
entryPaths: relocateEntries,
55165516
options: config.Options{
@@ -5522,7 +5522,7 @@ func TestVarRelocatingBundle(t *testing.T) {
55225522
}
55235523

55245524
func TestVarRelocatingNoBundle(t *testing.T) {
5525-
splitting_suite.expectBundled(t, bundled{
5525+
default_suite.expectBundled(t, bundled{
55265526
files: relocateFiles,
55275527
entryPaths: relocateEntries,
55285528
options: config.Options{
@@ -5817,7 +5817,7 @@ func TestEntryNamesNonPortableCharacter(t *testing.T) {
58175817
}
58185818

58195819
func TestEntryNamesChunkNamesExtPlaceholder(t *testing.T) {
5820-
loader_suite.expectBundled(t, bundled{
5820+
default_suite.expectBundled(t, bundled{
58215821
files: map[string]string{
58225822
"/src/entries/entry1.js": `import "../lib/shared.js"; import "./entry1.css"; console.log('entry1')`,
58235823
"/src/entries/entry2.js": `import "../lib/shared.js"; import "./entry2.css"; console.log('entry2')`,
@@ -5849,7 +5849,7 @@ func TestEntryNamesChunkNamesExtPlaceholder(t *testing.T) {
58495849
}
58505850

58515851
func TestMinifyIdentifiersImportPathFrequencyAnalysis(t *testing.T) {
5852-
loader_suite.expectBundled(t, bundled{
5852+
default_suite.expectBundled(t, bundled{
58535853
files: map[string]string{
58545854
"/import.js": `
58555855
import foo from "./WWWWWWWWWWXXXXXXXXXXYYYYYYYYYYZZZZZZZZZZ"
@@ -5877,7 +5877,7 @@ func TestMinifyIdentifiersImportPathFrequencyAnalysis(t *testing.T) {
58775877
}
58785878

58795879
func TestToESMWrapperOmission(t *testing.T) {
5880-
loader_suite.expectBundled(t, bundled{
5880+
default_suite.expectBundled(t, bundled{
58815881
files: map[string]string{
58825882
"/entry.js": `
58835883
import 'a_nowrap'
@@ -5928,7 +5928,7 @@ func TestToESMWrapperOmission(t *testing.T) {
59285928
// return foo2;
59295929
// };
59305930
func TestNamedFunctionExpressionArgumentCollision(t *testing.T) {
5931-
loader_suite.expectBundled(t, bundled{
5931+
default_suite.expectBundled(t, bundled{
59325932
files: map[string]string{
59335933
"/entry.js": `
59345934
let x = function foo(foo) {
@@ -5947,7 +5947,7 @@ func TestNamedFunctionExpressionArgumentCollision(t *testing.T) {
59475947
}
59485948

59495949
func TestNoWarnCommonJSExportsInESMPassThrough(t *testing.T) {
5950-
loader_suite.expectBundled(t, bundled{
5950+
default_suite.expectBundled(t, bundled{
59515951
files: map[string]string{
59525952
"/cjs-in-esm.js": `
59535953
export let foo = 1
@@ -5976,7 +5976,7 @@ func TestNoWarnCommonJSExportsInESMPassThrough(t *testing.T) {
59765976
}
59775977

59785978
func TestWarnCommonJSExportsInESMConvert(t *testing.T) {
5979-
loader_suite.expectBundled(t, bundled{
5979+
default_suite.expectBundled(t, bundled{
59805980
files: map[string]string{
59815981
"/cjs-in-esm.js": `
59825982
export let foo = 1
@@ -6019,7 +6019,7 @@ cjs-in-esm2.js: NOTE: This file is considered to be an ECMAScript module because
60196019
}
60206020

60216021
func TestWarnCommonJSExportsInESMBundle(t *testing.T) {
6022-
loader_suite.expectBundled(t, bundled{
6022+
default_suite.expectBundled(t, bundled{
60236023
files: map[string]string{
60246024
"/cjs-in-esm.js": `
60256025
export let foo = 1
@@ -6059,7 +6059,7 @@ cjs-in-esm.js: NOTE: This file is considered to be an ECMAScript module because
60596059
}
60606060

60616061
func TestMangleProps(t *testing.T) {
6062-
loader_suite.expectBundled(t, bundled{
6062+
default_suite.expectBundled(t, bundled{
60636063
files: map[string]string{
60646064
"/entry1.js": `
60656065
export function shouldMangle() {
@@ -6115,7 +6115,7 @@ func TestMangleProps(t *testing.T) {
61156115
}
61166116

61176117
func TestManglePropsMinify(t *testing.T) {
6118-
loader_suite.expectBundled(t, bundled{
6118+
default_suite.expectBundled(t, bundled{
61196119
files: map[string]string{
61206120
// These repeating characters test for frequency analysis
61216121

@@ -6175,7 +6175,7 @@ func TestManglePropsMinify(t *testing.T) {
61756175
}
61766176

61776177
func TestManglePropsKeywordPropertyMinify(t *testing.T) {
6178-
loader_suite.expectBundled(t, bundled{
6178+
default_suite.expectBundled(t, bundled{
61796179
files: map[string]string{
61806180
"/entry.js": `
61816181
class Foo {
@@ -6196,7 +6196,7 @@ func TestManglePropsKeywordPropertyMinify(t *testing.T) {
61966196
}
61976197

61986198
func TestManglePropsOptionalChain(t *testing.T) {
6199-
loader_suite.expectBundled(t, bundled{
6199+
default_suite.expectBundled(t, bundled{
62006200
files: map[string]string{
62016201
"/entry.js": `
62026202
export default function(x) {
@@ -6221,7 +6221,7 @@ func TestManglePropsOptionalChain(t *testing.T) {
62216221
}
62226222

62236223
func TestManglePropsLoweredOptionalChain(t *testing.T) {
6224-
loader_suite.expectBundled(t, bundled{
6224+
default_suite.expectBundled(t, bundled{
62256225
files: map[string]string{
62266226
"/entry.js": `
62276227
export default function(x) {
@@ -6247,7 +6247,7 @@ func TestManglePropsLoweredOptionalChain(t *testing.T) {
62476247
}
62486248

62496249
func TestReserveProps(t *testing.T) {
6250-
loader_suite.expectBundled(t, bundled{
6250+
default_suite.expectBundled(t, bundled{
62516251
files: map[string]string{
62526252
"/entry.js": `
62536253
export default {
@@ -6267,7 +6267,7 @@ func TestReserveProps(t *testing.T) {
62676267
}
62686268

62696269
func TestManglePropsImportExport(t *testing.T) {
6270-
loader_suite.expectBundled(t, bundled{
6270+
default_suite.expectBundled(t, bundled{
62716271
files: map[string]string{
62726272
// These don't count as property names, and aren't mangled
62736273
"/esm.js": `
@@ -6294,7 +6294,7 @@ func TestManglePropsImportExport(t *testing.T) {
62946294
}
62956295

62966296
func TestManglePropsImportExportBundled(t *testing.T) {
6297-
loader_suite.expectBundled(t, bundled{
6297+
default_suite.expectBundled(t, bundled{
62986298
files: map[string]string{
62996299
// Note: import and export syntax does not count as a property name. That
63006300
// means the following code is broken. This test just serves to document
@@ -6339,7 +6339,7 @@ func TestManglePropsImportExportBundled(t *testing.T) {
63396339
}
63406340

63416341
func TestManglePropsJSXTransform(t *testing.T) {
6342-
loader_suite.expectBundled(t, bundled{
6342+
default_suite.expectBundled(t, bundled{
63436343
files: map[string]string{
63446344
"/entry.jsx": `
63456345
let Foo = {
@@ -6371,7 +6371,7 @@ func TestManglePropsJSXTransform(t *testing.T) {
63716371
}
63726372

63736373
func TestManglePropsJSXPreserve(t *testing.T) {
6374-
loader_suite.expectBundled(t, bundled{
6374+
default_suite.expectBundled(t, bundled{
63756375
files: map[string]string{
63766376
"/entry.jsx": `
63776377
let Foo = {
@@ -6396,7 +6396,7 @@ func TestManglePropsJSXPreserve(t *testing.T) {
63966396
}
63976397

63986398
func TestManglePropsJSXTransformNamespace(t *testing.T) {
6399-
loader_suite.expectBundled(t, bundled{
6399+
default_suite.expectBundled(t, bundled{
64006400
files: map[string]string{
64016401
"/entry.jsx": `
64026402
export default [
@@ -6416,7 +6416,7 @@ func TestManglePropsJSXTransformNamespace(t *testing.T) {
64166416
}
64176417

64186418
func TestManglePropsAvoidCollisions(t *testing.T) {
6419-
loader_suite.expectBundled(t, bundled{
6419+
default_suite.expectBundled(t, bundled{
64206420
files: map[string]string{
64216421
"/entry.js": `
64226422
export default {
@@ -6438,7 +6438,7 @@ func TestManglePropsAvoidCollisions(t *testing.T) {
64386438
}
64396439

64406440
func TestManglePropsTypeScriptFeatures(t *testing.T) {
6441-
loader_suite.expectBundled(t, bundled{
6441+
default_suite.expectBundled(t, bundled{
64426442
files: map[string]string{
64436443
"/parameter-properties.ts": `
64446444
class Foo {
@@ -6546,7 +6546,7 @@ func TestManglePropsTypeScriptFeatures(t *testing.T) {
65466546
}
65476547

65486548
func TestManglePropsShorthand(t *testing.T) {
6549-
loader_suite.expectBundled(t, bundled{
6549+
default_suite.expectBundled(t, bundled{
65506550
files: map[string]string{
65516551
"/entry.js": `
65526552
// This should print as "({ y }) => ({ y })" not "({ y: y }) => ({ y: y })"
@@ -6564,7 +6564,7 @@ func TestManglePropsShorthand(t *testing.T) {
65646564
}
65656565

65666566
func TestManglePropsNoShorthand(t *testing.T) {
6567-
loader_suite.expectBundled(t, bundled{
6567+
default_suite.expectBundled(t, bundled{
65686568
files: map[string]string{
65696569
"/entry.js": `
65706570
// This should print as "({ y }) => ({ y: y })" not "({ y: y }) => ({ y: y })"
@@ -6583,7 +6583,7 @@ func TestManglePropsNoShorthand(t *testing.T) {
65836583
}
65846584

65856585
func TestManglePropsLoweredClassFields(t *testing.T) {
6586-
loader_suite.expectBundled(t, bundled{
6586+
default_suite.expectBundled(t, bundled{
65876587
files: map[string]string{
65886588
"/entry.js": `
65896589
class Foo {
@@ -6608,7 +6608,7 @@ func TestManglePropsLoweredClassFields(t *testing.T) {
66086608
// The fix was to prevent the property "constructor" from being mangled.
66096609
// See: https://github.com/evanw/esbuild/issues/1976
66106610
func TestManglePropsSuperCall(t *testing.T) {
6611-
loader_suite.expectBundled(t, bundled{
6611+
default_suite.expectBundled(t, bundled{
66126612
files: map[string]string{
66136613
"/entry.js": `
66146614
class Foo {}
@@ -6629,7 +6629,7 @@ func TestManglePropsSuperCall(t *testing.T) {
66296629
}
66306630

66316631
func TestMangleNoQuotedProps(t *testing.T) {
6632-
loader_suite.expectBundled(t, bundled{
6632+
default_suite.expectBundled(t, bundled{
66336633
files: map[string]string{
66346634
"/entry.js": `
66356635
x['_doNotMangleThis'];
@@ -6657,7 +6657,7 @@ func TestMangleNoQuotedProps(t *testing.T) {
66576657
}
66586658

66596659
func TestMangleNoQuotedPropsMinifySyntax(t *testing.T) {
6660-
loader_suite.expectBundled(t, bundled{
6660+
default_suite.expectBundled(t, bundled{
66616661
files: map[string]string{
66626662
"/entry.js": `
66636663
x['_doNotMangleThis'];
@@ -6686,7 +6686,7 @@ func TestMangleNoQuotedPropsMinifySyntax(t *testing.T) {
66866686
}
66876687

66886688
func TestMangleQuotedProps(t *testing.T) {
6689-
loader_suite.expectBundled(t, bundled{
6689+
default_suite.expectBundled(t, bundled{
66906690
files: map[string]string{
66916691
"/keep.js": `
66926692
foo("_keepThisProperty");
@@ -6734,7 +6734,7 @@ func TestMangleQuotedProps(t *testing.T) {
67346734
}
67356735

67366736
func TestMangleQuotedPropsMinifySyntax(t *testing.T) {
6737-
loader_suite.expectBundled(t, bundled{
6737+
default_suite.expectBundled(t, bundled{
67386738
files: map[string]string{
67396739
"/keep.js": `
67406740
foo("_keepThisProperty");
@@ -6783,7 +6783,7 @@ func TestMangleQuotedPropsMinifySyntax(t *testing.T) {
67836783
}
67846784

67856785
func TestIndirectRequireMessage(t *testing.T) {
6786-
loader_suite.expectBundled(t, bundled{
6786+
default_suite.expectBundled(t, bundled{
67876787
files: map[string]string{
67886788
"/array.js": `let x = [require]`,
67896789
"/assign.js": `require = x`,
@@ -6813,7 +6813,7 @@ ident.js: DEBUG: Indirect calls to "require" will not be bundled
68136813
}
68146814

68156815
func TestAmbiguousReexportMsg(t *testing.T) {
6816-
loader_suite.expectBundled(t, bundled{
6816+
default_suite.expectBundled(t, bundled{
68176817
files: map[string]string{
68186818
"/entry.js": `
68196819
export * from './a'
@@ -6839,7 +6839,7 @@ b.js: NOTE: Another definition of "x" comes from "b.js" here:
68396839

68406840
// See: https://github.com/evanw/esbuild/issues/2537
68416841
func TestNonDeterminismIssue2537(t *testing.T) {
6842-
loader_suite.expectBundled(t, bundled{
6842+
default_suite.expectBundled(t, bundled{
68436843
files: map[string]string{
68446844
"/entry.ts": `
68456845
export function aap(noot: boolean, wim: number) {
@@ -6875,7 +6875,7 @@ func TestNonDeterminismIssue2537(t *testing.T) {
68756875

68766876
// See: https://github.com/evanw/esbuild/issues/2697
68776877
func TestMinifiedJSXPreserveWithObjectSpread(t *testing.T) {
6878-
loader_suite.expectBundled(t, bundled{
6878+
default_suite.expectBundled(t, bundled{
68796879
files: map[string]string{
68806880
"/entry.jsx": `
68816881
const obj = {
@@ -6913,7 +6913,7 @@ func TestMinifiedJSXPreserveWithObjectSpread(t *testing.T) {
69136913
}
69146914

69156915
func TestPackageAlias(t *testing.T) {
6916-
loader_suite.expectBundled(t, bundled{
6916+
default_suite.expectBundled(t, bundled{
69176917
files: map[string]string{
69186918
"/entry.js": `
69196919
import "pkg1"
@@ -6958,7 +6958,7 @@ func TestPackageAlias(t *testing.T) {
69586958
}
69596959

69606960
func TestErrorsForAssertTypeJSON(t *testing.T) {
6961-
loader_suite.expectBundled(t, bundled{
6961+
default_suite.expectBundled(t, bundled{
69626962
files: map[string]string{
69636963
"/js-entry.js": `
69646964
import all from './foo.json' assert { type: 'json' }
@@ -7037,7 +7037,7 @@ NOTE: You can either keep the import assertion and only use the "default" import
70377037
}
70387038

70397039
func TestOutputForAssertTypeJSON(t *testing.T) {
7040-
loader_suite.expectBundled(t, bundled{
7040+
default_suite.expectBundled(t, bundled{
70417041
files: map[string]string{
70427042
"/js-entry.js": `
70437043
import all from './foo.json' assert { type: 'json' }
@@ -7084,7 +7084,7 @@ NOTE: You can either keep the import assertion and only use the "default" import
70847084
}
70857085

70867086
func TestExternalPackages(t *testing.T) {
7087-
loader_suite.expectBundled(t, bundled{
7087+
default_suite.expectBundled(t, bundled{
70887088
files: map[string]string{
70897089
"/project/entry.js": `
70907090
import 'pkg1'
@@ -7117,7 +7117,7 @@ func TestExternalPackages(t *testing.T) {
71177117
}
71187118

71197119
func TestMetafileVariousCases(t *testing.T) {
7120-
loader_suite.expectBundled(t, bundled{
7120+
default_suite.expectBundled(t, bundled{
71217121
files: map[string]string{
71227122
"/project/entry.js": `
71237123
import a from 'extern-esm'
@@ -7182,7 +7182,7 @@ func TestMetafileVariousCases(t *testing.T) {
71827182
}
71837183

71847184
func TestMetafileNoBundle(t *testing.T) {
7185-
loader_suite.expectBundled(t, bundled{
7185+
default_suite.expectBundled(t, bundled{
71867186
files: map[string]string{
71877187
"/project/entry.js": `
71887188
import a from 'pkg'
@@ -7216,7 +7216,7 @@ func TestMetafileNoBundle(t *testing.T) {
72167216
}
72177217

72187218
func TestMetafileVeryLongExternalPaths(t *testing.T) {
7219-
loader_suite.expectBundled(t, bundled{
7219+
default_suite.expectBundled(t, bundled{
72207220
files: map[string]string{
72217221
"/project/bytesInOutput should be at least 99 (1).js": `
72227222
import a from './` + strings.Repeat("1", 99) + `.file'

0 commit comments

Comments
 (0)