github.com/evanw/esbuild@v0.21.4/internal/bundler_tests/snapshots/snapshots_splitting.txt (about)

     1  TestEdgeCaseIssue2793WithSplitting
     2  ---------- /out/index.js ----------
     3  // src/a.js
     4  var A = 42;
     5  
     6  // src/b.js
     7  var B = async () => (await import("./index.js")).A;
     8  export {
     9    A,
    10    B
    11  };
    12  
    13  ================================================================================
    14  TestEdgeCaseIssue2793WithoutSplitting
    15  ---------- /out/index.js ----------
    16  // src/a.js
    17  var A;
    18  var init_a = __esm({
    19    "src/a.js"() {
    20      A = 42;
    21    }
    22  });
    23  
    24  // src/b.js
    25  var B;
    26  var init_b = __esm({
    27    "src/b.js"() {
    28      B = async () => (await Promise.resolve().then(() => (init_src(), src_exports))).A;
    29    }
    30  });
    31  
    32  // src/index.js
    33  var src_exports = {};
    34  __export(src_exports, {
    35    A: () => A,
    36    B: () => B
    37  });
    38  var init_src = __esm({
    39    "src/index.js"() {
    40      init_a();
    41      init_b();
    42    }
    43  });
    44  init_src();
    45  export {
    46    A,
    47    B
    48  };
    49  
    50  ================================================================================
    51  TestSplittingAssignToLocal
    52  ---------- /out/a.js ----------
    53  import {
    54    foo,
    55    setFoo
    56  } from "./chunk-GX7G2SBE.js";
    57  
    58  // a.js
    59  setFoo(123);
    60  console.log(foo);
    61  
    62  ---------- /out/b.js ----------
    63  import {
    64    foo
    65  } from "./chunk-GX7G2SBE.js";
    66  
    67  // b.js
    68  console.log(foo);
    69  
    70  ---------- /out/chunk-GX7G2SBE.js ----------
    71  // shared.js
    72  var foo;
    73  function setFoo(value) {
    74    foo = value;
    75  }
    76  
    77  export {
    78    foo,
    79    setFoo
    80  };
    81  
    82  ================================================================================
    83  TestSplittingChunkPathDirPlaceholderImplicitOutbase
    84  ---------- /out/entry.js ----------
    85  // project/entry.js
    86  console.log(import("./output-path/should-contain/this-text/file-G2XPANW2.js"));
    87  
    88  ---------- /out/output-path/should-contain/this-text/file-G2XPANW2.js ----------
    89  // project/output-path/should-contain/this-text/file.js
    90  console.log("file.js");
    91  
    92  ================================================================================
    93  TestSplittingCircularReferenceIssue251
    94  ---------- /out/a.js ----------
    95  import {
    96    p,
    97    q
    98  } from "./chunk-HK23737J.js";
    99  export {
   100    p,
   101    q
   102  };
   103  
   104  ---------- /out/b.js ----------
   105  import {
   106    p,
   107    q
   108  } from "./chunk-HK23737J.js";
   109  export {
   110    p,
   111    q
   112  };
   113  
   114  ---------- /out/chunk-HK23737J.js ----------
   115  // a.js
   116  var p = 5;
   117  
   118  // b.js
   119  var q = 6;
   120  
   121  export {
   122    q,
   123    p
   124  };
   125  
   126  ================================================================================
   127  TestSplittingCrossChunkAssignmentDependencies
   128  ---------- /out/a.js ----------
   129  import {
   130    setValue
   131  } from "./chunk-3GNPIT25.js";
   132  
   133  // a.js
   134  setValue(123);
   135  
   136  ---------- /out/b.js ----------
   137  import "./chunk-3GNPIT25.js";
   138  
   139  ---------- /out/chunk-3GNPIT25.js ----------
   140  // shared.js
   141  var observer;
   142  var value;
   143  function getValue() {
   144    return value;
   145  }
   146  function setValue(next) {
   147    value = next;
   148    if (observer) observer();
   149  }
   150  sideEffects(getValue);
   151  
   152  export {
   153    setValue
   154  };
   155  
   156  ================================================================================
   157  TestSplittingCrossChunkAssignmentDependenciesRecursive
   158  ---------- /out/a.js ----------
   159  import {
   160    setX
   161  } from "./chunk-NAKBUG5G.js";
   162  
   163  // a.js
   164  setX();
   165  
   166  ---------- /out/b.js ----------
   167  import {
   168    setZ
   169  } from "./chunk-BSMDVSN6.js";
   170  import "./chunk-NAKBUG5G.js";
   171  
   172  // b.js
   173  setZ();
   174  
   175  ---------- /out/c.js ----------
   176  import {
   177    setY2,
   178    setZ2
   179  } from "./chunk-BSMDVSN6.js";
   180  import {
   181    setX2
   182  } from "./chunk-NAKBUG5G.js";
   183  
   184  // c.js
   185  setX2();
   186  setY2();
   187  setZ2();
   188  
   189  ---------- /out/chunk-BSMDVSN6.js ----------
   190  import {
   191    setX
   192  } from "./chunk-NAKBUG5G.js";
   193  
   194  // y.js
   195  var _y;
   196  function setY(v) {
   197    _y = v;
   198  }
   199  function setY2(v) {
   200    setX(v);
   201    _y = v;
   202  }
   203  
   204  // z.js
   205  var _z;
   206  function setZ(v) {
   207    _z = v;
   208  }
   209  function setZ2(v) {
   210    setY(v);
   211    _z = v;
   212  }
   213  
   214  export {
   215    setY2,
   216    setZ,
   217    setZ2
   218  };
   219  
   220  ---------- /out/chunk-NAKBUG5G.js ----------
   221  // x.js
   222  var _x;
   223  function setX(v) {
   224    _x = v;
   225  }
   226  function setX2(v) {
   227    _x = v;
   228  }
   229  
   230  export {
   231    setX,
   232    setX2
   233  };
   234  
   235  ================================================================================
   236  TestSplittingDuplicateChunkCollision
   237  ---------- /out/a.js ----------
   238  import"./chunk-QPOQRTMB.js";
   239  
   240  ---------- /out/b.js ----------
   241  import"./chunk-QPOQRTMB.js";
   242  
   243  ---------- /out/chunk-QPOQRTMB.js ----------
   244  console.log(123);
   245  
   246  ---------- /out/c.js ----------
   247  import"./chunk-TOGNOMR3.js";
   248  
   249  ---------- /out/d.js ----------
   250  import"./chunk-TOGNOMR3.js";
   251  
   252  ---------- /out/chunk-TOGNOMR3.js ----------
   253  console.log(123);
   254  
   255  ================================================================================
   256  TestSplittingDynamicAndNotDynamicCommonJSIntoES6
   257  ---------- /out/entry.js ----------
   258  import {
   259    __toESM,
   260    require_foo
   261  } from "./chunk-X3UWZZCR.js";
   262  
   263  // entry.js
   264  var import_foo = __toESM(require_foo());
   265  import("./foo-BJYZ44Z3.js").then(({ default: { bar: b } }) => console.log(import_foo.bar, b));
   266  
   267  ---------- /out/foo-BJYZ44Z3.js ----------
   268  import {
   269    require_foo
   270  } from "./chunk-X3UWZZCR.js";
   271  export default require_foo();
   272  
   273  ---------- /out/chunk-X3UWZZCR.js ----------
   274  // foo.js
   275  var require_foo = __commonJS({
   276    "foo.js"(exports) {
   277      exports.bar = 123;
   278    }
   279  });
   280  
   281  export {
   282    __toESM,
   283    require_foo
   284  };
   285  
   286  ================================================================================
   287  TestSplittingDynamicAndNotDynamicES6IntoES6
   288  ---------- /out/entry.js ----------
   289  import {
   290    bar
   291  } from "./chunk-UDDKLWVZ.js";
   292  
   293  // entry.js
   294  import("./foo-BNHN4WV6.js").then(({ bar: b }) => console.log(bar, b));
   295  
   296  ---------- /out/foo-BNHN4WV6.js ----------
   297  import {
   298    bar
   299  } from "./chunk-UDDKLWVZ.js";
   300  export {
   301    bar
   302  };
   303  
   304  ---------- /out/chunk-UDDKLWVZ.js ----------
   305  // foo.js
   306  var bar = 123;
   307  
   308  export {
   309    bar
   310  };
   311  
   312  ================================================================================
   313  TestSplittingDynamicCommonJSIntoES6
   314  ---------- /out/entry.js ----------
   315  // entry.js
   316  import("./foo-X6C7FV5C.js").then(({ default: { bar } }) => console.log(bar));
   317  
   318  ---------- /out/foo-X6C7FV5C.js ----------
   319  // foo.js
   320  var require_foo = __commonJS({
   321    "foo.js"(exports) {
   322      exports.bar = 123;
   323    }
   324  });
   325  export default require_foo();
   326  
   327  ================================================================================
   328  TestSplittingDynamicES6IntoES6
   329  ---------- /out/entry.js ----------
   330  // entry.js
   331  import("./foo-R2VCCZUR.js").then(({ bar }) => console.log(bar));
   332  
   333  ---------- /out/foo-R2VCCZUR.js ----------
   334  // foo.js
   335  var bar = 123;
   336  export {
   337    bar
   338  };
   339  
   340  ================================================================================
   341  TestSplittingDynamicImportIssue272
   342  ---------- /out/a.js ----------
   343  // a.js
   344  import("./b.js");
   345  
   346  ---------- /out/b.js ----------
   347  // b.js
   348  var b_default = 1;
   349  export {
   350    b_default as default
   351  };
   352  
   353  ================================================================================
   354  TestSplittingDynamicImportOutsideSourceTreeIssue264
   355  ---------- /out/entry1.js ----------
   356  // Users/user/project/src/entry1.js
   357  import("./package-ZBNDRRRB.js");
   358  
   359  ---------- /out/entry2.js ----------
   360  // Users/user/project/src/entry2.js
   361  import("./package-ZBNDRRRB.js");
   362  
   363  ---------- /out/package-ZBNDRRRB.js ----------
   364  // Users/user/project/node_modules/package/index.js
   365  console.log("imported");
   366  
   367  ================================================================================
   368  TestSplittingHybridESMAndCJSIssue617
   369  ---------- /out/a.js ----------
   370  import {
   371    foo,
   372    init_a
   373  } from "./chunk-PDZFCFBH.js";
   374  init_a();
   375  export {
   376    foo
   377  };
   378  
   379  ---------- /out/b.js ----------
   380  import {
   381    __toCommonJS,
   382    a_exports,
   383    init_a
   384  } from "./chunk-PDZFCFBH.js";
   385  
   386  // b.js
   387  var bar = (init_a(), __toCommonJS(a_exports));
   388  export {
   389    bar
   390  };
   391  
   392  ---------- /out/chunk-PDZFCFBH.js ----------
   393  // a.js
   394  var a_exports = {};
   395  __export(a_exports, {
   396    foo: () => foo
   397  });
   398  var foo;
   399  var init_a = __esm({
   400    "a.js"() {
   401    }
   402  });
   403  
   404  export {
   405    __toCommonJS,
   406    foo,
   407    a_exports,
   408    init_a
   409  };
   410  
   411  ================================================================================
   412  TestSplittingMinifyIdentifiersCrashIssue437
   413  ---------- /out/a.js ----------
   414  import {
   415    a as o
   416  } from "./chunk-7N7J6VKT.js";
   417  
   418  // a.js
   419  console.log(o);
   420  
   421  ---------- /out/b.js ----------
   422  import {
   423    a as o
   424  } from "./chunk-7N7J6VKT.js";
   425  
   426  // b.js
   427  console.log(o);
   428  
   429  ---------- /out/c.js ----------
   430  import "./chunk-7N7J6VKT.js";
   431  
   432  ---------- /out/chunk-7N7J6VKT.js ----------
   433  // shared.js
   434  function f(o) {
   435  }
   436  
   437  export {
   438    f as a
   439  };
   440  
   441  ================================================================================
   442  TestSplittingMissingLazyExport
   443  ---------- /out/a.js ----------
   444  import {
   445    foo
   446  } from "./chunk-QVTGQSXT.js";
   447  
   448  // a.js
   449  console.log(foo());
   450  
   451  ---------- /out/b.js ----------
   452  import {
   453    bar
   454  } from "./chunk-QVTGQSXT.js";
   455  
   456  // b.js
   457  console.log(bar());
   458  
   459  ---------- /out/chunk-QVTGQSXT.js ----------
   460  // empty.js
   461  var empty_exports = {};
   462  
   463  // common.js
   464  function foo() {
   465    return [empty_exports, void 0];
   466  }
   467  function bar() {
   468    return [void 0];
   469  }
   470  
   471  export {
   472    foo,
   473    bar
   474  };
   475  
   476  ================================================================================
   477  TestSplittingNestedDirectories
   478  ---------- /Users/user/project/out/pageA/page.js ----------
   479  import {
   480    shared_default
   481  } from "../chunk-GWC2ABNX.js";
   482  
   483  // Users/user/project/src/pages/pageA/page.js
   484  console.log(shared_default);
   485  
   486  ---------- /Users/user/project/out/pageB/page.js ----------
   487  import {
   488    shared_default
   489  } from "../chunk-GWC2ABNX.js";
   490  
   491  // Users/user/project/src/pages/pageB/page.js
   492  console.log(-shared_default);
   493  
   494  ---------- /Users/user/project/out/chunk-GWC2ABNX.js ----------
   495  // Users/user/project/src/pages/shared.js
   496  var shared_default = 123;
   497  
   498  export {
   499    shared_default
   500  };
   501  
   502  ================================================================================
   503  TestSplittingPublicPathEntryName
   504  ---------- /out/a.js ----------
   505  // a.js
   506  import("/www/b-AQIID5BE.js");
   507  
   508  ---------- /out/b-AQIID5BE.js ----------
   509  // b.js
   510  console.log("b");
   511  
   512  ================================================================================
   513  TestSplittingReExportIssue273
   514  ---------- /out/a.js ----------
   515  import {
   516    a
   517  } from "./chunk-RLFZNZQZ.js";
   518  export {
   519    a
   520  };
   521  
   522  ---------- /out/b.js ----------
   523  import {
   524    a
   525  } from "./chunk-RLFZNZQZ.js";
   526  export {
   527    a
   528  };
   529  
   530  ---------- /out/chunk-RLFZNZQZ.js ----------
   531  // a.js
   532  var a = 1;
   533  
   534  export {
   535    a
   536  };
   537  
   538  ================================================================================
   539  TestSplittingSharedCommonJSIntoES6
   540  ---------- /out/a.js ----------
   541  import {
   542    require_shared
   543  } from "./chunk-JQJBVS2P.js";
   544  
   545  // a.js
   546  var { foo } = require_shared();
   547  console.log(foo);
   548  
   549  ---------- /out/b.js ----------
   550  import {
   551    require_shared
   552  } from "./chunk-JQJBVS2P.js";
   553  
   554  // b.js
   555  var { foo } = require_shared();
   556  console.log(foo);
   557  
   558  ---------- /out/chunk-JQJBVS2P.js ----------
   559  // shared.js
   560  var require_shared = __commonJS({
   561    "shared.js"(exports) {
   562      exports.foo = 123;
   563    }
   564  });
   565  
   566  export {
   567    require_shared
   568  };
   569  
   570  ================================================================================
   571  TestSplittingSharedES6IntoES6
   572  ---------- /out/a.js ----------
   573  import {
   574    foo
   575  } from "./chunk-25TWIR6T.js";
   576  
   577  // a.js
   578  console.log(foo);
   579  
   580  ---------- /out/b.js ----------
   581  import {
   582    foo
   583  } from "./chunk-25TWIR6T.js";
   584  
   585  // b.js
   586  console.log(foo);
   587  
   588  ---------- /out/chunk-25TWIR6T.js ----------
   589  // shared.js
   590  var foo = 123;
   591  
   592  export {
   593    foo
   594  };
   595  
   596  ================================================================================
   597  TestSplittingSideEffectsWithoutDependencies
   598  ---------- /out/a.js ----------
   599  import {
   600    a
   601  } from "./chunk-Y3CWGI3W.js";
   602  
   603  // a.js
   604  console.log(a);
   605  
   606  ---------- /out/b.js ----------
   607  import {
   608    b
   609  } from "./chunk-Y3CWGI3W.js";
   610  
   611  // b.js
   612  console.log(b);
   613  
   614  ---------- /out/chunk-Y3CWGI3W.js ----------
   615  // shared.js
   616  var a = 1;
   617  var b = 2;
   618  console.log("side effect");
   619  
   620  export {
   621    a,
   622    b
   623  };