TestBase64LoaderRemoveUnused
---------- /out.js ----------
// entry.js
console.log("unused import");

================================================================================
TestDataURLLoaderRemoveUnused
---------- /out.js ----------
// entry.js
console.log("unused import");

================================================================================
TestDeadCodeFollowingJump
---------- /out.js ----------
// entry.js
function testReturn() {
  return y + z();
  if (x)
    var y;
  function z() {
    KEEP_ME();
  }
}
function testThrow() {
  throw y + z();
  if (x)
    var y;
  function z() {
    KEEP_ME();
  }
}
function testBreak() {
  for (; ; ) {
    y + z();
    break;
    if (x)
      var y;
    function z() {
      KEEP_ME();
    }
  }
}
function testContinue() {
  for (; ; ) {
    y + z();
    continue;
    if (x)
      var y;
    function z() {
      KEEP_ME();
    }
  }
}
function testStmts() {
  return [a, b, c, d, e, f, g, h, i];
  for (; x; )
    var a;
  do
    var b;
  while (x);
  for (var c; ; )
    ;
  for (var d in x)
    ;
  for (var e of x)
    ;
  if (x)
    var f;
  if (!x)
    var g;
  var h;
  x:
    var i;
}
testReturn();
testThrow();
testBreak();
testContinue();
testStmts();

================================================================================
TestDisableTreeShaking
---------- /out.js ----------
// keep-me/index.js
console.log("side effects");

// entry.jsx
function KeepMe1() {
}
var keepMe2 = React.createElement(KeepMe1, null);
function keepMe3() {
  console.log("side effects");
}
var keepMe4 = keepMe3();
var keepMe5 = pure();
var keepMe6 = some.fn();

================================================================================
TestFileLoaderRemoveUnused
---------- /out.js ----------
// entry.js
console.log("unused import");

================================================================================
TestImportReExportOfNamespaceImport
---------- /out.js ----------
// Users/user/project/node_modules/pkg/foo.js
var require_foo = __commonJS((exports, module) => {
  module.exports = 123;
});

// Users/user/project/node_modules/pkg/index.js
var import_foo = __toModule(require_foo());

// Users/user/project/entry.js
console.log(import_foo.default);

================================================================================
TestJSONLoaderRemoveUnused
---------- /out.js ----------
// entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayGlob
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/keep/this/file.js
console.log("this should be kept");

================================================================================
TestPackageJsonSideEffectsArrayKeep
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
console.log("hello");

// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayKeepMainImplicitMain
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index-main.js
var require_index_main = __commonJS((exports) => {
  __export(exports, {
    foo: () => foo2
  });
  var foo2 = 123;
  console.log("this should be kept");
});

// Users/user/project/src/entry.js
var import_demo_pkg = __toModule(require_index_main());

// Users/user/project/src/require-demo-pkg.js
require_index_main();

// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayKeepMainImplicitModule
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayKeepMainUseMain
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index-main.js
console.log("this should be kept");

// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayKeepMainUseModule
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayKeepModuleImplicitMain
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index-main.js
var require_index_main = __commonJS((exports) => {
  __export(exports, {
    foo: () => foo
  });
  var foo = 123;
  console.log("this should be kept");
});

// Users/user/project/src/require-demo-pkg.js
require_index_main();

// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayKeepModuleImplicitModule
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index-module.js
console.log("this should be kept");

// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayKeepModuleUseMain
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayKeepModuleUseModule
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index-module.js
console.log("this should be kept");

// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsArrayRemove
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsFalseKeepBareImportAndRequireCommonJS
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
var require_demo_pkg = __commonJS((exports) => {
  exports.foo = 123;
  console.log("hello");
});

// Users/user/project/src/entry.js
require_demo_pkg();
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsFalseKeepBareImportAndRequireES6
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
var require_demo_pkg = __commonJS((exports) => {
  __export(exports, {
    foo: () => foo
  });
  var foo = 123;
  console.log("hello");
});

// Users/user/project/src/entry.js
require_demo_pkg();
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsFalseKeepNamedImportCommonJS
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
var require_demo_pkg = __commonJS((exports) => {
  exports.foo = 123;
  console.log("hello");
});

// Users/user/project/src/entry.js
var import_demo_pkg = __toModule(require_demo_pkg());
console.log(import_demo_pkg.foo);

================================================================================
TestPackageJsonSideEffectsFalseKeepNamedImportES6
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
var foo = 123;
console.log("hello");

// Users/user/project/src/entry.js
console.log(foo);

================================================================================
TestPackageJsonSideEffectsFalseKeepStarImportCommonJS
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
var require_demo_pkg = __commonJS((exports) => {
  exports.foo = 123;
  console.log("hello");
});

// Users/user/project/src/entry.js
var ns = __toModule(require_demo_pkg());
console.log(ns);

================================================================================
TestPackageJsonSideEffectsFalseKeepStarImportES6
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
var demo_pkg_exports = {};
__export(demo_pkg_exports, {
  foo: () => foo
});
var foo = 123;
console.log("hello");

// Users/user/project/src/entry.js
console.log(demo_pkg_exports);

================================================================================
TestPackageJsonSideEffectsFalseRemoveBareImportCommonJS
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsFalseRemoveBareImportES6
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsFalseRemoveNamedImportCommonJS
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsFalseRemoveNamedImportES6
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsFalseRemoveStarImportCommonJS
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsFalseRemoveStarImportES6
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsKeepExportDefaultExpr
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
var demo_pkg_default = exprWithSideEffects();

// Users/user/project/src/entry.js
console.log(demo_pkg_default);

================================================================================
TestPackageJsonSideEffectsNestedDirectoryRemove
---------- /out.js ----------
// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsTrueKeepCommonJS
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
var require_demo_pkg = __commonJS((exports) => {
  exports.foo = 123;
  console.log("hello");
});

// Users/user/project/src/entry.js
var import_demo_pkg = __toModule(require_demo_pkg());
console.log("unused import");

================================================================================
TestPackageJsonSideEffectsTrueKeepES6
---------- /out.js ----------
// Users/user/project/node_modules/demo-pkg/index.js
console.log("hello");

// Users/user/project/src/entry.js
console.log("unused import");

================================================================================
TestRemoveTrailingReturn
---------- /out.js ----------
// entry.js
function foo() {
  a && b();
}
function bar() {
  return a && b(), KEEP_ME;
}
var entry_default = [
  foo,
  bar,
  function() {
    a && b();
  },
  function() {
    return a && b(), KEEP_ME;
  },
  () => {
    a && b();
  },
  () => (a && b(), KEEP_ME)
];
export {
  entry_default as default
};

================================================================================
TestRemoveUnusedImportMeta
---------- /out.js ----------
// entry.js
console.log("foo is unused");

================================================================================
TestRemoveUnusedPureCommentCalls
---------- /out.js ----------
// entry.js
function bar() {
}
var bare = foo(bar);
var at_no = /* @__PURE__ */ foo(bar());
var new_at_no = /* @__PURE__ */ new foo(bar());
var nospace_at_no = /* @__PURE__ */ foo(bar());
var nospace_new_at_no = /* @__PURE__ */ new foo(bar());
var num_no = /* @__PURE__ */ foo(bar());
var new_num_no = /* @__PURE__ */ new foo(bar());
var nospace_num_no = /* @__PURE__ */ foo(bar());
var nospace_new_num_no = /* @__PURE__ */ new foo(bar());
var dot_no = /* @__PURE__ */ foo(sideEffect()).dot(bar());
var new_dot_no = /* @__PURE__ */ new foo(sideEffect()).dot(bar());
var nested_no = [1, /* @__PURE__ */ foo(bar()), 2];
var new_nested_no = [1, /* @__PURE__ */ new foo(bar()), 2];
var single_at_no = /* @__PURE__ */ foo(bar());
var new_single_at_no = /* @__PURE__ */ new foo(bar());
var single_num_no = /* @__PURE__ */ foo(bar());
var new_single_num_no = /* @__PURE__ */ new foo(bar());
var bad_no = foo(bar);
var new_bad_no = new foo(bar);
var parens_no = foo(bar);
var new_parens_no = new foo(bar);
var exp_no = /* @__PURE__ */ foo() ** foo();
var new_exp_no = /* @__PURE__ */ new foo() ** foo();

================================================================================
TestTextLoaderRemoveUnused
---------- /out.js ----------
// entry.js
console.log("unused import");

================================================================================
TestTreeShakingBinaryOperators
---------- /out.js ----------
// entry.js
var keep;
var keep2;
keep + keep2;
keep - keep2;
keep * keep2;
keep / keep2;
keep % keep2;
keep ** keep2;
keep < keep2;
keep <= keep2;
keep > keep2;
keep >= keep2;
keep in keep2;
keep instanceof keep2;
keep << keep2;
keep >> keep2;
keep >>> keep2;
keep == keep2;
keep != keep2;
keep | keep2;
keep & keep2;
keep ^ keep2;
keep = keep2;
keep += keep2;
keep -= keep2;
keep *= keep2;
keep /= keep2;
keep %= keep2;
keep **= keep2;
keep <<= keep2;
keep >>= keep2;
keep >>>= keep2;
keep |= keep2;
keep &= keep2;
keep ^= keep2;
keep ??= keep2;
keep ||= keep2;
keep &&= keep2;

================================================================================
TestTreeShakingImportIdentifier
---------- /out.js ----------
// b.js
var Base = class {
};

// a.js
var Keep = class extends Base {
};

// entry.js
new Keep();

================================================================================
TestTreeShakingNoBundleCJS
---------- /out.js ----------
function keep() {
}
function unused() {
}
keep();

================================================================================
TestTreeShakingNoBundleESM
---------- /out.js ----------
function keep() {
}
function unused() {
}
keep();

================================================================================
TestTreeShakingNoBundleIIFE
---------- /out.js ----------
(() => {
  function keep() {
  }
  keep();
})();

================================================================================
TestTreeShakingReactElements
---------- /out.js ----------
// entry.jsx
function Foo() {
}
var d = /* @__PURE__ */ React.createElement("div", null);
var e = /* @__PURE__ */ React.createElement(Foo, null, d);
var f = /* @__PURE__ */ React.createElement(React.Fragment, null, e);
console.log(f);

================================================================================
TestTreeShakingUnaryOperators
---------- /out.js ----------
// entry.js
var keep;
+keep;
-keep;
~keep;
delete keep;
++keep;
--keep;
keep++;
keep--;
