browser_dbg-sourcemapped-scopes.js (42668B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 "use strict"; 6 7 // This test can be really slow on debug platforms and should be split. 8 requestLongerTimeout(30); 9 10 // Tests loading sourcemapped sources for Babel's compile output. 11 12 /* eslint-disable no-inline-comments */ 13 14 const ACTIVE_TARGETS = new Set([ 15 // "webpack3", 16 "webpack3-babel6", 17 // "webpack3-babel7", 18 // "webpack4", 19 // "webpack4-babel6", 20 // "webpack4-babel7", 21 "rollup", 22 // "rollup-babel6", 23 // "rollup-babel7", 24 "parcel", 25 ]); 26 27 const ACTIVE_FIXTURES = [ 28 testBabelBindingsWithFlow, 29 testBabelFlowtypeBindings, 30 testEvalMaps, 31 testForOf, 32 testShadowedVars, 33 testLineStartBindingsES6, 34 testThisArgumentsBindings, 35 testClasses, 36 testForLoops, 37 testFunctions, 38 testSwitches, 39 testTryCatches, 40 testLexAndNonlex, 41 testTypescriptClasses, 42 testTypeModule, 43 testTypeScriptCJS, 44 testOutOfOrderDeclarationsCJS, 45 testModulesCJS, 46 testWebpackLineMappings, 47 testWebpackFunctions, 48 testESModules, 49 testESModulesCJS, 50 testESModulesES6, 51 ]; 52 53 async function breakpointScopes( 54 dbg, 55 target, 56 fixture, 57 { line, column }, 58 scopes 59 ) { 60 if (!ACTIVE_TARGETS.has(target)) { 61 return; 62 } 63 64 const extension = fixture == "typescript-classes" ? "ts" : "js"; 65 const url = `${target}://./${fixture}/input.${extension}`; 66 const fnName = pairToFnName(target, fixture); 67 68 await invokeWithBreakpoint(dbg, fnName, url, { line, column }, async () => { 69 await assertScopes(dbg, scopes); 70 }); 71 72 ok(true, `Ran tests for ${fixture} at line ${line} column ${column}`); 73 } 74 75 add_task(async function () { 76 await pushPref("devtools.debugger.map-scopes-enabled", true); 77 const dbg = await initDebugger("doc-sourcemapped.html"); 78 79 for (const fixture of ACTIVE_FIXTURES) { 80 await fixture(dbg); 81 } 82 }); 83 84 function targetToFlags(target) { 85 const isRollup = target.startsWith("rollup"); 86 const isWebpack = target.startsWith("webpack"); 87 const isParcel = target.startsWith("parcel"); 88 const isWebpack4 = target.startsWith("webpack4"); 89 90 // Rollup removes lots of things as dead code, so they are marked as optimized out. 91 const rollupOptimized = isRollup ? "(optimized away)" : null; 92 const webpackImportGetter = isWebpack ? "Getter" : null; 93 const webpack4ImportGetter = isWebpack4 ? "Getter" : null; 94 const maybeLineStart = col => col; 95 const defaultExport = isWebpack4 96 ? name => `${name}()` 97 : name => [name, "(optimized away)"]; 98 99 return { 100 isRollup, 101 isWebpack, 102 isParcel, 103 rollupOptimized, 104 webpackImportGetter, 105 webpack4ImportGetter, 106 maybeLineStart, 107 defaultExport, 108 }; 109 } 110 function pairToFnName(target, fixture) { 111 return `${target}-${fixture}`.replace(/-([a-z])/g, (s, c) => c.toUpperCase()); 112 } 113 114 function runtimeFunctionName(target, fixture) { 115 // Webpack 4 appears to output it's bundles in such a way that Spidermonkey 116 if (target === "webpack4") { 117 return "js"; 118 } 119 120 return pairToFnName(target, fixture); 121 } 122 123 function webpackModule(target, fixture, optimizedOut) { 124 return [ 125 runtimeFunctionName(target, fixture), 126 ["__webpack_exports__", optimizedOut ? "(optimized away)" : "{\u2026}"], 127 optimizedOut 128 ? ["__webpack_require__", "(optimized away)"] 129 : "__webpack_require__()", 130 ["arguments", optimizedOut ? "(unavailable)" : "Arguments"], 131 ]; 132 } 133 134 async function testBabelBindingsWithFlow(dbg) { 135 // Flow is not available on the non-babel builds. 136 for (const target of [ 137 "parcel", 138 "rollup-babel6", 139 "rollup-babel7", 140 "webpack3-babel6", 141 "webpack3-babel7", 142 "webpack4-babel6", 143 "webpack4-babel7", 144 ]) { 145 const { webpackImportGetter } = targetToFlags(target); 146 147 await breakpointScopes( 148 dbg, 149 target, 150 "babel-bindings-with-flow", 151 { line: 9, column: 3 }, 152 [ 153 "root", 154 ["value", '"a-named"'], 155 "Module", 156 ["aNamed", webpackImportGetter || '"a-named"'], 157 "root()", 158 ] 159 ); 160 } 161 } 162 163 async function testBabelFlowtypeBindings(dbg) { 164 // Flow is not available on the non-babel builds. 165 for (const target of [ 166 "parcel", 167 "rollup-babel6", 168 "rollup-babel7", 169 "webpack3-babel6", 170 "webpack3-babel7", 171 "webpack4-babel6", 172 "webpack4-babel7", 173 ]) { 174 const { webpackImportGetter } = targetToFlags(target); 175 176 await breakpointScopes( 177 dbg, 178 target, 179 "babel-flowtype-bindings", 180 { line: 9, column: 3 }, 181 [ 182 "Module", 183 ["aConst", '"a-const"'], 184 ["Four", webpackImportGetter || '"one"'], 185 "root()", 186 ] 187 ); 188 } 189 } 190 191 async function testEvalMaps(dbg) { 192 // At times, this test has been a bit flakey due to the inlined source map 193 // never loading. I'm not sure what causes that. If we observe flakiness in CI, 194 // we should consider disabling this test for now. 195 196 for (const target of ["webpack3", "webpack4"]) { 197 const { defaultExport } = targetToFlags(target); 198 199 await breakpointScopes(dbg, target, "eval-maps", { line: 14, column: 5 }, [ 200 "Block", 201 ["<this>", "Window"], 202 ["three", "5"], 203 ["two", "4"], 204 "Block", 205 ["three", "3"], 206 ["two", "2"], 207 "Block", 208 ["arguments", "Arguments"], 209 ["one", "1"], 210 ...webpackModule(target, "eval-maps", true /* optimized out */), 211 ["module", "(optimized away)"], 212 defaultExport("root"), 213 ]); 214 } 215 216 for (const target of [ 217 "parcel", 218 "rollup", 219 "rollup-babel6", 220 "rollup-babel7", 221 "webpack3-babel6", 222 "webpack3-babel7", 223 "webpack4-babel6", 224 "webpack4-babel7", 225 ]) { 226 const { defaultExport, rollupOptimized, maybeLineStart } = 227 targetToFlags(target); 228 229 await breakpointScopes( 230 dbg, 231 target, 232 "eval-maps", 233 { line: 14, column: maybeLineStart(5) }, 234 [ 235 "Block", 236 ["three", "5"], 237 ["two", "4"], 238 "Function Body", 239 ["three", rollupOptimized || "3"], 240 ["two", rollupOptimized || "2"], 241 "root", 242 ["one", "1"], 243 "Module", 244 defaultExport("root"), 245 ] 246 ); 247 } 248 } 249 250 async function testForOf(dbg) { 251 for (const target of ["webpack3", "webpack4"]) { 252 const { defaultExport } = targetToFlags(target); 253 254 await breakpointScopes(dbg, target, "for-of", { line: 5, column: 1 }, [ 255 "Block", 256 ["<this>", "Window"], 257 ["x", "1"], 258 "Block", 259 ["arguments", "Arguments"], 260 "class doThing", 261 "Block", 262 "mod", 263 ...webpackModule(target, "for-of", true /* optimizedOut */), 264 defaultExport("forOf"), 265 "module", 266 ]); 267 } 268 269 for (const target of [ 270 "parcel", 271 "rollup", 272 "rollup-babel6", 273 "rollup-babel7", 274 "webpack3-babel6", 275 "webpack3-babel7", 276 "webpack4-babel6", 277 "webpack4-babel7", 278 ]) { 279 const { defaultExport, maybeLineStart } = targetToFlags(target); 280 281 await breakpointScopes( 282 dbg, 283 target, 284 "for-of", 285 { line: 5, column: maybeLineStart(5) }, 286 [ 287 "For", 288 ["x", "1"], 289 "forOf", 290 "doThing(arg)", 291 "Module", 292 defaultExport("forOf"), 293 "mod", 294 ] 295 ); 296 } 297 } 298 299 async function testShadowedVars(dbg) { 300 for (const target of ["webpack3", "webpack4"]) { 301 await breakpointScopes( 302 dbg, 303 target, 304 "shadowed-vars", 305 { line: 18, column: 1 }, 306 [ 307 "Block", 308 ["<this>", "Window"], 309 ["aConst", '"const3"'], 310 ["aLet", '"let3"'], 311 312 "Block", 313 ["aConst", '"const2"'], 314 ["aLet", '"let2"'], 315 "class Outer", 316 317 "Block", 318 ["aConst", '"const1"'], 319 ["aLet", '"let1"'], 320 "class Outer", 321 322 "Block", 323 ["arguments", "Arguments"], 324 ["aVar", '"var3"'], 325 326 ...webpackModule(target, "shadowed-vars", true /* optimizedOut */), 327 ["module", "(optimized away)"], 328 ] 329 ); 330 } 331 332 for (const target of [ 333 "parcel", 334 "rollup", 335 "rollup-babel6", 336 "rollup-babel7", 337 "webpack3-babel6", 338 "webpack3-babel7", 339 "webpack4-babel6", 340 "webpack4-babel7", 341 ]) { 342 const { isParcel, rollupOptimized, maybeLineStart } = targetToFlags(target); 343 344 await breakpointScopes( 345 dbg, 346 target, 347 "shadowed-vars", 348 { line: 18, column: maybeLineStart(7) }, 349 [ 350 "Block", 351 ["aConst", rollupOptimized || '"const3"'], 352 ["aLet", rollupOptimized || '"let3"'], 353 "Block", 354 ["aConst", rollupOptimized || '"const2"'], 355 ["aLet", rollupOptimized || '"let2"'], 356 // eslint-disable-next-line no-nested-ternary 357 isParcel 358 ? "Outer()" 359 : rollupOptimized 360 ? ["Outer", rollupOptimized] 361 : "Outer:_Outer()", 362 "Function Body", 363 ["aConst", rollupOptimized || '"const1"'], 364 ["aLet", rollupOptimized || '"let1"'], 365 // eslint-disable-next-line no-nested-ternary 366 rollupOptimized 367 ? ["Outer", rollupOptimized] 368 : isParcel 369 ? "class Outer" 370 : "Outer()", 371 "default", 372 ["aVar", rollupOptimized || '"var3"'], 373 ] 374 ); 375 } 376 } 377 378 async function testLineStartBindingsES6(dbg) { 379 for (const target of ["webpack3", "webpack4"]) { 380 await breakpointScopes( 381 dbg, 382 target, 383 "line-start-bindings-es6", 384 { line: 19, column: 1 }, 385 [ 386 "Block", 387 ["<this>", "{\u2026}"], 388 ["one", "1"], 389 ["two", "2"], 390 "Block", 391 ["arguments", "Arguments"], 392 393 "Block", 394 ["aFunc", "(optimized away)"], 395 ["arguments", "(unavailable)"], 396 397 ...webpackModule( 398 target, 399 "line-start-bindings-es6", 400 true /* optimizedOut */ 401 ), 402 ["module", "(optimized away)"], 403 "root()", 404 ] 405 ); 406 } 407 408 for (const target of [ 409 "parcel", 410 "rollup", 411 "rollup-babel6", 412 "rollup-babel7", 413 "webpack3-babel6", 414 "webpack3-babel7", 415 "webpack4-babel6", 416 "webpack4-babel7", 417 ]) { 418 const { rollupOptimized, maybeLineStart } = targetToFlags(target); 419 420 await breakpointScopes( 421 dbg, 422 target, 423 "line-start-bindings-es6", 424 { line: 19, column: maybeLineStart(5) }, 425 [ 426 "Function Body", 427 ["<this>", "{\u2026}"], 428 ["one", rollupOptimized || "1"], 429 ["two", rollupOptimized || "2"], 430 "root", 431 ["aFunc", "(optimized away)"], 432 "Module", 433 "root()", 434 ] 435 ); 436 } 437 } 438 439 async function testThisArgumentsBindings(dbg) { 440 for (const target of ["webpack3", "webpack4"]) { 441 await breakpointScopes( 442 dbg, 443 target, 444 "this-arguments-bindings", 445 { line: 4, column: 1 }, 446 [ 447 "Block", 448 ["<this>", '"this-value"'], 449 ["arrow", "(uninitialized)"], 450 "fn", 451 ["arg", '"arg-value"'], 452 ["arguments", "Arguments"], 453 "root", 454 ["arguments", "Arguments"], 455 "fn()", 456 ...webpackModule( 457 target, 458 "this-arguments-bindings", 459 true /* optimizedOut */ 460 ), 461 ["module", "(optimized away)"], 462 "root()", 463 ] 464 ); 465 466 await breakpointScopes( 467 dbg, 468 target, 469 "this-arguments-bindings", 470 { line: 8, column: 1 }, 471 [ 472 "Block", 473 ["<this>", '"this-value"'], 474 ["argArrow", '"arrow-arg"'], 475 ["arguments", "Arguments"], 476 "Block", 477 ["arrow", "(optimized away)"], 478 "fn", 479 ["arg", '"arg-value"'], 480 ["arguments", "Arguments"], 481 "root", 482 ["arguments", "Arguments"], 483 "fn()", 484 ...webpackModule( 485 target, 486 "this-arguments-bindings", 487 true /* optimizedOut */ 488 ), 489 ["module", "(optimized away)"], 490 "root()", 491 ] 492 ); 493 } 494 495 for (const target of [ 496 "parcel", 497 "rollup", 498 "rollup-babel6", 499 "rollup-babel7", 500 "webpack3-babel6", 501 "webpack3-babel7", 502 "webpack4-babel6", 503 "webpack4-babel7", 504 ]) { 505 const { isParcel, maybeLineStart } = targetToFlags(target); 506 507 await breakpointScopes( 508 dbg, 509 target, 510 "this-arguments-bindings", 511 { line: 4, column: maybeLineStart(5) }, 512 [ 513 "Function Body", 514 ["<this>", '"this-value"'], 515 [ 516 "arrow", 517 target === "rollup" || isParcel ? "(uninitialized)" : "undefined", 518 ], 519 "fn", 520 ["arg", '"arg-value"'], 521 ["arguments", "Arguments"], 522 "root", 523 "fn(arg)", 524 "Module", 525 "root()", 526 ] 527 ); 528 529 await breakpointScopes( 530 dbg, 531 target, 532 "this-arguments-bindings", 533 { line: 8, column: maybeLineStart(7) }, 534 [ 535 "arrow", 536 ["<this>", '"this-value"'], 537 ["argArrow", '"arrow-arg"'], 538 "Function Body", 539 target === "rollup" || isParcel 540 ? ["arrow", "(optimized away)"] 541 : "arrow(argArrow)", 542 "fn", 543 ["arg", '"arg-value"'], 544 ["arguments", "Arguments"], 545 "root", 546 "fn(arg)", 547 "Module", 548 "root()", 549 ] 550 ); 551 } 552 } 553 554 async function testClasses(dbg) { 555 for (const target of ["webpack3", "webpack4"]) { 556 await breakpointScopes(dbg, target, "classes", { line: 6, column: 1 }, [ 557 "Block", 558 ["<this>", "{}"], 559 ["arguments", "Arguments"], 560 "Block", 561 ["Thing", "(optimized away)"], 562 "Block", 563 "Another()", 564 ["one", "1"], 565 "Thing()", 566 "Block", 567 ["arguments", "(unavailable)"], 568 ...webpackModule(target, "classes", true /* optimizedOut */), 569 ["module", "(optimized away)"], 570 "root()", 571 ]); 572 573 await breakpointScopes(dbg, target, "classes", { line: 16, column: 1 }, [ 574 "Block", 575 ["<this>", "{}"], 576 ["three", "3"], 577 ["two", "2"], 578 "Block", 579 ["arguments", "Arguments"], 580 "Block", 581 "Another()", 582 "Block", 583 "Another()", 584 ["one", "1"], 585 "Thing()", 586 "Block", 587 ["arguments", "(unavailable)"], 588 ...webpackModule(target, "classes", true /* optimizedOut */), 589 ["module", "(optimized away)"], 590 "root()", 591 ]); 592 } 593 594 for (const target of [ 595 "parcel", 596 "rollup", 597 "rollup-babel6", 598 "rollup-babel7", 599 "webpack3-babel6", 600 "webpack3-babel7", 601 "webpack4-babel6", 602 "webpack4-babel7", 603 ]) { 604 const { isParcel, rollupOptimized, maybeLineStart } = targetToFlags(target); 605 606 await breakpointScopes( 607 dbg, 608 target, 609 "classes", 610 { line: 6, column: maybeLineStart(7) }, 611 [ 612 "Class", 613 target === "rollup" || isParcel 614 ? ["Thing", "(optimized away)"] 615 : "Thing()", 616 "Function Body", 617 target === "webpack3-babel6" ? "Another()" : "class Another", 618 "one", 619 target === "rollup" || isParcel 620 ? ["Thing", "(optimized away)"] 621 : "Thing()", 622 "Module", 623 "root()", 624 ] 625 ); 626 627 await breakpointScopes( 628 dbg, 629 target, 630 "classes", 631 { line: 16, column: maybeLineStart(7) }, 632 [ 633 "Function Body", 634 ["three", rollupOptimized || "3"], 635 ["two", rollupOptimized || "2"], 636 "Class", 637 target === "webpack3-babel6" ? "Another()" : "class Another", 638 "Function Body", 639 target === "webpack3-babel6" ? "Another()" : "class Another", 640 ["one", "1"], 641 target === "webpack3-babel6" ? "Thing()" : "class Thing", 642 "Module", 643 "root()", 644 ] 645 ); 646 } 647 } 648 649 async function testForLoops(dbg) { 650 for (const target of ["webpack3", "webpack4"]) { 651 await breakpointScopes(dbg, target, "for-loops", { line: 5, column: 1 }, [ 652 "Block", 653 ["<this>", "Window"], 654 ["i", "1"], 655 "Block", 656 ["i", "0"], 657 "Block", 658 ["arguments", "Arguments"], 659 ...webpackModule(target, "for-loops", true /* optimizedOut */), 660 ["module", "(optimized away)"], 661 "root()", 662 ]); 663 await breakpointScopes(dbg, target, "for-loops", { line: 9, column: 1 }, [ 664 "Block", 665 ["<this>", "Window"], 666 ["i", '"2"'], 667 "Block", 668 ["i", "0"], 669 "Block", 670 ["arguments", "Arguments"], 671 ...webpackModule(target, "for-loops", true /* optimizedOut */), 672 ["module", "(optimized away)"], 673 "root()", 674 ]); 675 await breakpointScopes(dbg, target, "for-loops", { line: 13, column: 1 }, [ 676 "Block", 677 ["<this>", "Window"], 678 ["i", "3"], 679 "Block", 680 ["i", "0"], 681 "Block", 682 ["arguments", "Arguments"], 683 ...webpackModule(target, "for-loops", true /* optimizedOut */), 684 ["module", "(optimized away)"], 685 "root()", 686 ]); 687 } 688 689 for (const target of [ 690 "parcel", 691 "rollup", 692 "rollup-babel6", 693 "rollup-babel7", 694 "webpack3-babel6", 695 "webpack3-babel7", 696 "webpack4-babel6", 697 "webpack4-babel7", 698 ]) { 699 const { rollupOptimized, maybeLineStart } = targetToFlags(target); 700 701 await breakpointScopes( 702 dbg, 703 target, 704 "for-loops", 705 { line: 5, column: maybeLineStart(5) }, 706 [ 707 "For", 708 ["i", "1"], 709 "Function Body", 710 ["i", rollupOptimized || "0"], 711 "Module", 712 "root()", 713 ] 714 ); 715 await breakpointScopes( 716 dbg, 717 target, 718 "for-loops", 719 { line: 9, column: maybeLineStart(5) }, 720 [ 721 "For", 722 ["i", '"2"'], 723 "Function Body", 724 ["i", rollupOptimized || "0"], 725 "Module", 726 "root()", 727 ] 728 ); 729 await breakpointScopes( 730 dbg, 731 target, 732 "for-loops", 733 { line: 13, column: maybeLineStart(5) }, 734 [ 735 "For", 736 ["i", target === "rollup" ? "3" : rollupOptimized || "3"], 737 "Function Body", 738 ["i", rollupOptimized || "0"], 739 "Module", 740 "root()", 741 ] 742 ); 743 } 744 } 745 746 async function testFunctions(dbg) { 747 for (const target of ["webpack3", "webpack4"]) { 748 await breakpointScopes(dbg, target, "functions", { line: 6, column: 1 }, [ 749 "Block", 750 ["<this>", "(optimized away)"], 751 ["arguments", "Arguments"], 752 ["p3", "undefined"], 753 "Block", 754 "arrow()", 755 "inner", 756 ["arguments", "Arguments"], 757 ["p2", "undefined"], 758 "Block", 759 "inner(p2)", 760 "Block", 761 ["inner", "(optimized away)"], 762 "decl", 763 ["arguments", "Arguments"], 764 ["p1", "undefined"], 765 "root", 766 ["arguments", "Arguments"], 767 "decl()", 768 ...webpackModule(target, "functions", true /* optimizedOut */), 769 ["module", "(optimized away)"], 770 "root()", 771 ]); 772 } 773 774 for (const target of [ 775 "parcel", 776 "rollup", 777 "rollup-babel6", 778 "rollup-babel7", 779 "webpack3-babel6", 780 "webpack3-babel7", 781 "webpack4-babel6", 782 "webpack4-babel7", 783 ]) { 784 const { isParcel, maybeLineStart } = targetToFlags(target); 785 786 await breakpointScopes( 787 dbg, 788 target, 789 "functions", 790 { line: 6, column: maybeLineStart(9) }, 791 [ 792 "arrow", 793 ["p3", "undefined"], 794 "Function Body", 795 "arrow(p3)", 796 "inner", 797 ["p2", "undefined"], 798 "Function Expression", 799 "inner(p2)", 800 "Function Body", 801 target === "rollup" || isParcel 802 ? ["inner", "(optimized away)"] 803 : "inner(p2)", 804 "decl", 805 ["p1", "undefined"], 806 "root", 807 "decl(p1)", 808 "Module", 809 "root()", 810 ] 811 ); 812 } 813 } 814 815 async function testSwitches(dbg) { 816 for (const target of ["webpack3", "webpack4"]) { 817 await breakpointScopes(dbg, target, "switches", { line: 7, column: 1 }, [ 818 "Block", 819 ["<this>", "Window"], 820 ["val", "2"], 821 "Block", 822 ["val", "1"], 823 "Block", 824 ["arguments", "Arguments"], 825 ...webpackModule(target, "switches", true /* optimizedOut */), 826 ["module", "(optimized away)"], 827 "root()", 828 ]); 829 830 await breakpointScopes(dbg, target, "switches", { line: 10, column: 1 }, [ 831 "Block", 832 ["<this>", "Window"], 833 ["val", "3"], 834 "Block", 835 ["val", "2"], 836 "Block", 837 ["val", "1"], 838 "Block", 839 ["arguments", "Arguments"], 840 ...webpackModule(target, "switches", true /* optimizedOut */), 841 ["module", "(optimized away)"], 842 "root()", 843 ]); 844 } 845 846 for (const target of [ 847 "parcel", 848 "rollup", 849 "rollup-babel6", 850 "rollup-babel7", 851 "webpack3-babel6", 852 "webpack3-babel7", 853 "webpack4-babel6", 854 "webpack4-babel7", 855 ]) { 856 const { rollupOptimized, maybeLineStart } = targetToFlags(target); 857 858 await breakpointScopes( 859 dbg, 860 target, 861 "switches", 862 { line: 7, column: maybeLineStart(7) }, 863 [ 864 "Switch", 865 ["val", rollupOptimized || "2"], 866 "Function Body", 867 ["val", rollupOptimized || "1"], 868 "Module", 869 "root()", 870 ] 871 ); 872 873 await breakpointScopes( 874 dbg, 875 target, 876 "switches", 877 { line: 10, column: maybeLineStart(7) }, 878 [ 879 "Block", 880 ["val", rollupOptimized || "3"], 881 "Switch", 882 ["val", rollupOptimized || "2"], 883 "Function Body", 884 ["val", rollupOptimized || "1"], 885 "Module", 886 "root()", 887 ] 888 ); 889 } 890 } 891 892 async function testTryCatches(dbg) { 893 for (const target of ["webpack3", "webpack4"]) { 894 await breakpointScopes(dbg, target, "try-catches", { line: 8, column: 1 }, [ 895 "Block", 896 ["<this>", "Window"], 897 ["two", "2"], 898 "Block", 899 ["err", '"AnError"'], 900 "Block", 901 ["one", "1"], 902 "Block", 903 ["arguments", "Arguments"], 904 ...webpackModule(target, "try-catches", true /* optimizedOut */), 905 ["module", "(optimized away)"], 906 "root()", 907 ]); 908 } 909 910 for (const target of [ 911 "parcel", 912 "rollup", 913 "rollup-babel6", 914 "rollup-babel7", 915 "webpack3-babel6", 916 "webpack3-babel7", 917 "webpack4-babel6", 918 "webpack4-babel7", 919 ]) { 920 const { rollupOptimized, maybeLineStart } = targetToFlags(target); 921 922 await breakpointScopes( 923 dbg, 924 target, 925 "try-catches", 926 { line: 8, column: maybeLineStart(5) }, 927 [ 928 "Block", 929 ["two", rollupOptimized || "2"], 930 "Catch", 931 ["err", '"AnError"'], 932 "Function Body", 933 ["one", rollupOptimized || "1"], 934 "Module", 935 "root()", 936 ] 937 ); 938 } 939 } 940 941 async function testLexAndNonlex(dbg) { 942 for (const target of ["webpack3", "webpack4"]) { 943 await breakpointScopes( 944 dbg, 945 target, 946 "lex-and-nonlex", 947 { line: 3, column: 1 }, 948 [ 949 "Block", 950 ["<this>", "undefined"], 951 ["arguments", "Arguments"], 952 "Block", 953 "class Thing", 954 "Block", 955 ["arguments", "(unavailable)"], 956 ["someHelper", "(optimized away)"], 957 ...webpackModule(target, "lex-and-nonlex", true /* optimizedOut */), 958 ["module", "(optimized away)"], 959 "root()", 960 ] 961 ); 962 } 963 964 for (const target of [ 965 "parcel", 966 "rollup", 967 "rollup-babel6", 968 "rollup-babel7", 969 "webpack3-babel6", 970 "webpack3-babel7", 971 "webpack4-babel6", 972 "webpack4-babel7", 973 ]) { 974 const { isParcel, maybeLineStart } = targetToFlags(target); 975 976 await breakpointScopes( 977 dbg, 978 target, 979 "lex-and-nonlex", 980 { line: 3, column: maybeLineStart(5) }, 981 [ 982 "Function Body", 983 target === "rollup" || target === "parcel" ? "class Thing" : "Thing()", 984 "root", 985 target === "rollup" || isParcel 986 ? ["someHelper", "(optimized away)"] 987 : "someHelper()", 988 "Module", 989 "root()", 990 ] 991 ); 992 } 993 } 994 995 async function testTypescriptClasses(dbg) { 996 // Typescript is not available on the Babel builds. 997 for (const target of ["parcel", "webpack3", "webpack4", "rollup"]) { 998 const { isRollup, isParcel, rollupOptimized } = targetToFlags(target); 999 1000 await breakpointScopes( 1001 dbg, 1002 target, 1003 "typescript-classes", 1004 { line: 50, column: 3 }, 1005 [ 1006 "Module", 1007 "AnotherThing()", 1008 "AppComponent()", 1009 "decoratorFactory(opts)", 1010 rollupOptimized ? ["def", rollupOptimized] : "def()", 1011 rollupOptimized 1012 ? ["ExportedOther", rollupOptimized] 1013 : "ExportedOther()", 1014 rollupOptimized 1015 ? ["ExpressionClass", rollupOptimized] 1016 : "ExpressionClass:Foo()", 1017 "fn(arg)", 1018 // Rollup optimizes out the 'ns' reference here, but when it does, it leave a mapping 1019 // pointed at a location that is super weird, so it ends up being unmapped instead 1020 // be "(optimized out)". 1021 // Parcel converts the "ns;" mapping into a single full-line mapping, for some reason. 1022 // That may have to do with https://github.com/parcel-bundler/parcel/pull/1755#discussion_r205584159 1023 // though it's not 100% clear. 1024 ["ns", isRollup || isParcel ? "(unmapped)" : "{\u2026}"], 1025 "SubDecl()", 1026 "SubVar:SubExpr()", 1027 ] 1028 ); 1029 } 1030 } 1031 1032 async function testTypeModule(dbg) { 1033 for (const target of ["webpack3", "webpack4"]) { 1034 await breakpointScopes(dbg, target, "type-module", { line: 7, column: 1 }, [ 1035 "Block", 1036 ["<this>", "Window"], 1037 ["arguments", "Arguments"], 1038 "Block", 1039 ["alsoModuleScoped", "2"], 1040 ...webpackModule(target, "type-module", true /* optimizedOut */), 1041 ["module", "(optimized away)"], 1042 ["moduleScoped", "1"], 1043 "thirdModuleScoped()", 1044 ]); 1045 } 1046 1047 for (const target of [ 1048 "parcel", 1049 "rollup", 1050 "rollup-babel6", 1051 "rollup-babel7", 1052 "webpack3-babel6", 1053 "webpack3-babel7", 1054 "webpack4-babel6", 1055 "webpack4-babel7", 1056 ]) { 1057 const { maybeLineStart } = targetToFlags(target); 1058 1059 await breakpointScopes( 1060 dbg, 1061 target, 1062 "type-module", 1063 { line: 7, column: maybeLineStart(3) }, 1064 [ 1065 "Module", 1066 ["alsoModuleScoped", "2"], 1067 ["moduleScoped", "1"], 1068 "thirdModuleScoped()", 1069 ] 1070 ); 1071 } 1072 } 1073 1074 async function testTypeScriptCJS(dbg) { 1075 for (const target of ["webpack3", "webpack4"]) { 1076 await breakpointScopes( 1077 dbg, 1078 target, 1079 "type-script-cjs", 1080 { line: 7, column: 1 }, 1081 [ 1082 "Block", 1083 ["<this>", "Window"], 1084 ["arguments", "Arguments"], 1085 "Block", 1086 "alsoModuleScopes", 1087 1088 runtimeFunctionName(target, "type-script-cjs"), 1089 ["arguments", "(unavailable)"], 1090 ["exports", "(optimized away)"], 1091 ["module", "(optimized away)"], 1092 "moduleScoped", 1093 "nonModules", 1094 "thirdModuleScoped", 1095 ] 1096 ); 1097 } 1098 1099 // CJS does not work on Rollup. 1100 for (const target of [ 1101 "parcel", 1102 "webpack3-babel6", 1103 "webpack3-babel7", 1104 "webpack4-babel6", 1105 "webpack4-babel7", 1106 ]) { 1107 await breakpointScopes( 1108 dbg, 1109 target, 1110 "type-script-cjs", 1111 { line: 7, column: 3 }, 1112 [ 1113 "Module", 1114 "alsoModuleScopes", 1115 "moduleScoped", 1116 "nonModules", 1117 "thirdModuleScoped", 1118 ] 1119 ); 1120 } 1121 } 1122 1123 async function testOutOfOrderDeclarationsCJS(dbg) { 1124 // CJS does not work on Rollup. 1125 for (const target of [ 1126 "parcel", 1127 "webpack3-babel6", 1128 "webpack3-babel7", 1129 "webpack4-babel6", 1130 "webpack4-babel7", 1131 ]) { 1132 await breakpointScopes( 1133 dbg, 1134 target, 1135 "out-of-order-declarations-cjs", 1136 { line: 8, column: 5 }, 1137 [ 1138 "callback", 1139 "fn(inner)", 1140 ["val", "undefined"], 1141 "root", 1142 ["callback", "(optimized away)"], 1143 ["fn", "(optimized away)"], 1144 ["val", "(optimized away)"], 1145 "Module", 1146 1147 // This value is currently optimized away, which isn't 100% accurate. 1148 // Because import declarations is the last thing in the file, our current 1149 // logic doesn't cover _both_ 'var' statements that it generates, 1150 // making us use the first, optimized-out binding. Given that imports 1151 // are almost never the last thing in a file though, this is probably not 1152 // a huge deal for now. 1153 [ 1154 "aDefault", 1155 target.match(/webpack(3|4)-babel7/) 1156 ? '"a-default"' 1157 : "(optimized away)", 1158 ], 1159 ["root", "(optimized away)"], 1160 ["val", "(optimized away)"], 1161 ] 1162 ); 1163 } 1164 } 1165 1166 async function testModulesCJS(dbg) { 1167 for (const target of ["webpack3", "webpack4"]) { 1168 await breakpointScopes(dbg, target, "modules-cjs", { line: 7, column: 1 }, [ 1169 "Block", 1170 ["<this>", "Window"], 1171 ["arguments", "Arguments"], 1172 "Block", 1173 ["alsoModuleScoped", "2"], 1174 runtimeFunctionName(target, "modules-cjs"), 1175 ["arguments", "(unavailable)"], 1176 ["exports", "(optimized away)"], 1177 ["module", "(optimized away)"], 1178 ["moduleScoped", "1"], 1179 "thirdModuleScoped()", 1180 ]); 1181 } 1182 1183 // CJS does not work on Rollup. 1184 for (const target of [ 1185 "parcel", 1186 "webpack3-babel6", 1187 "webpack3-babel7", 1188 "webpack4-babel6", 1189 "webpack4-babel7", 1190 ]) { 1191 await breakpointScopes(dbg, target, "modules-cjs", { line: 7, column: 3 }, [ 1192 "Module", 1193 ["alsoModuleScoped", "2"], 1194 ["moduleScoped", "1"], 1195 "thirdModuleScoped()", 1196 ]); 1197 } 1198 } 1199 1200 async function testWebpackLineMappings(dbg) { 1201 await breakpointScopes( 1202 dbg, 1203 "webpack3", 1204 "webpack-line-mappings", 1205 { line: 11, column: 1 }, 1206 [ 1207 "Block", 1208 ["<this>", '"this-value"'], 1209 ["arg", '"arg-value"'], 1210 ["arguments", "Arguments"], 1211 ["inner", "undefined"], 1212 "Block", 1213 ["someName", "(optimized away)"], 1214 "Block", 1215 ["two", "2"], 1216 "Block", 1217 ["one", "1"], 1218 "root", 1219 ["arguments", "Arguments"], 1220 "fn:someName()", 1221 runtimeFunctionName("webpack3", "webpack-line-mappings"), 1222 ["__webpack_exports__", "(optimized away)"], 1223 ["__WEBPACK_IMPORTED_MODULE_0__src_mod1__", "{\u2026}"], 1224 ["__webpack_require__", "(optimized away)"], 1225 ["arguments", "(unavailable)"], 1226 ["module", "(optimized away)"], 1227 "root()", 1228 ] 1229 ); 1230 1231 await breakpointScopes( 1232 dbg, 1233 "webpack4", 1234 "webpack-line-mappings", 1235 { line: 11, column: 1 }, 1236 [ 1237 "Block", 1238 ["<this>", '"this-value"'], 1239 ["arg", '"arg-value"'], 1240 ["arguments", "Arguments"], 1241 ["inner", "undefined"], 1242 "Block", 1243 ["someName", "(optimized away)"], 1244 "Block", 1245 ["two", "2"], 1246 "Block", 1247 ["one", "1"], 1248 "root", 1249 ["arguments", "Arguments"], 1250 "fn:someName()", 1251 runtimeFunctionName("webpack4", "webpack-line-mappings"), 1252 ["__webpack_exports__", "(optimized away)"], 1253 ["__webpack_require__", "(optimized away)"], 1254 ["_src_mod1__WEBPACK_IMPORTED_MODULE_0__", "{\u2026}"], 1255 ["arguments", "(unavailable)"], 1256 ["module", "(optimized away)"], 1257 "root()", 1258 ] 1259 ); 1260 } 1261 1262 async function testWebpackFunctions(dbg) { 1263 for (const target of ["webpack3", "webpack4"]) { 1264 const { defaultExport } = targetToFlags(target); 1265 1266 await breakpointScopes( 1267 dbg, 1268 target, 1269 "webpack-functions", 1270 { line: 4, column: 1 }, 1271 [ 1272 "Block", 1273 ["<this>", "{\u2026}"], 1274 ["arguments", "Arguments"], 1275 ["x", "4"], 1276 runtimeFunctionName(target, "webpack-functions"), 1277 ["__webpack_exports__", "(optimized away)"], 1278 ["__webpack_require__", "(optimized away)"], 1279 ["arguments", "(unavailable)"], 1280 ["module", "{\u2026}"], 1281 defaultExport("root"), 1282 ] 1283 ); 1284 } 1285 } 1286 1287 async function testESModules(dbg) { 1288 await breakpointScopes( 1289 dbg, 1290 "webpack3", 1291 "esmodules", 1292 { line: 20, column: 1 }, 1293 [ 1294 "Block", 1295 ["<this>", "Window"], 1296 ["arguments", "Arguments"], 1297 runtimeFunctionName("webpack3", "esmodules"), 1298 "__webpack_exports__", 1299 "__WEBPACK_IMPORTED_MODULE_0__src_mod1__", 1300 "__WEBPACK_IMPORTED_MODULE_1__src_mod2__", 1301 "__WEBPACK_IMPORTED_MODULE_10__src_optimized_out__", 1302 "__WEBPACK_IMPORTED_MODULE_2__src_mod3__", 1303 "__WEBPACK_IMPORTED_MODULE_3__src_mod4__", 1304 "__WEBPACK_IMPORTED_MODULE_4__src_mod5__", 1305 "__WEBPACK_IMPORTED_MODULE_5__src_mod6__", 1306 "__WEBPACK_IMPORTED_MODULE_6__src_mod7__", 1307 "__WEBPACK_IMPORTED_MODULE_7__src_mod9__", 1308 "__WEBPACK_IMPORTED_MODULE_8__src_mod10__", 1309 "__WEBPACK_IMPORTED_MODULE_9__src_mod11__", 1310 "__webpack_require__", 1311 "arguments", 1312 "example", 1313 "module", 1314 "root()", 1315 ] 1316 ); 1317 1318 await breakpointScopes( 1319 dbg, 1320 "webpack4", 1321 "esmodules", 1322 { line: 20, column: 1 }, 1323 [ 1324 "Block", 1325 ["<this>", "Window"], 1326 ["arguments", "Arguments"], 1327 runtimeFunctionName("webpack4", "esmodules"), 1328 "__webpack_exports__", 1329 "__webpack_require__", 1330 "_src_mod1__WEBPACK_IMPORTED_MODULE_0__", 1331 "_src_mod10__WEBPACK_IMPORTED_MODULE_8__", 1332 "_src_mod11__WEBPACK_IMPORTED_MODULE_9__", 1333 "_src_mod2__WEBPACK_IMPORTED_MODULE_1__", 1334 "_src_mod3__WEBPACK_IMPORTED_MODULE_2__", 1335 "_src_mod4__WEBPACK_IMPORTED_MODULE_3__", 1336 "_src_mod5__WEBPACK_IMPORTED_MODULE_4__", 1337 "_src_mod6__WEBPACK_IMPORTED_MODULE_5__", 1338 "_src_mod7__WEBPACK_IMPORTED_MODULE_6__", 1339 "_src_mod9__WEBPACK_IMPORTED_MODULE_7__", 1340 "_src_optimized_out__WEBPACK_IMPORTED_MODULE_10__", 1341 "arguments", 1342 "example()", 1343 "module", 1344 "root()", 1345 ] 1346 ); 1347 1348 for (const target of [ 1349 "parcel", 1350 "rollup", 1351 "webpack3-babel6", 1352 "webpack3-babel7", 1353 "webpack4-babel6", 1354 "webpack4-babel7", 1355 ]) { 1356 const { defaultExport, webpackImportGetter, maybeLineStart } = 1357 targetToFlags(target); 1358 1359 await breakpointScopes( 1360 dbg, 1361 target, 1362 "esmodules", 1363 { line: 20, column: maybeLineStart(3) }, 1364 [ 1365 "Module", 1366 ["aDefault", '"a-default"'], 1367 ["aDefault2", '"a-default2"'], 1368 ["aDefault3", '"a-default3"'], 1369 ["anAliased", webpackImportGetter || '"an-original"'], 1370 ["anAliased2", webpackImportGetter || '"an-original2"'], 1371 ["anAliased3", webpackImportGetter || '"an-original3"'], 1372 ["aNamed", webpackImportGetter || '"a-named"'], 1373 ["aNamed2", webpackImportGetter || '"a-named2"'], 1374 ["aNamed3", webpackImportGetter || '"a-named3"'], 1375 ["aNamespace", "{\u2026}"], 1376 ["anotherNamed", webpackImportGetter || '"a-named"'], 1377 ["anotherNamed2", webpackImportGetter || '"a-named2"'], 1378 ["anotherNamed3", webpackImportGetter || '"a-named3"'], 1379 defaultExport("example"), 1380 ["optimizedOut", "(optimized away)"], 1381 "root()", 1382 ] 1383 ); 1384 } 1385 1386 for (const target of ["rollup-babel6", "rollup-babel7"]) { 1387 // This test currently bails out because Babel does not map function calls 1388 // fully and includes the () of the call in the range of the identifier. 1389 // this means that Rollup, has to map locations for calls to imports, 1390 // it can fail. This will be addressed in Babel eventually. 1391 await breakpointScopes(dbg, target, "esmodules", { line: 20, column: 3 }, [ 1392 "root", 1393 ["<this>", "Window"], 1394 ["arguments", "Arguments"], 1395 runtimeFunctionName(target, "esmodules"), 1396 ["aDefault", '"a-default"'], 1397 ["aDefault2", '"a-default2"'], 1398 ["aDefault3", '"a-default3"'], 1399 ["aNamed", '"a-named"'], 1400 ["aNamed$1", "(optimized away)"], 1401 ["aNamed2", '"a-named2"'], 1402 ["aNamed3", '"a-named3"'], 1403 ["aNamespace", "{\u2026}"], 1404 ["arguments", "(unavailable)"], 1405 ["mod4", "(optimized away)"], 1406 ["original", '"an-original"'], 1407 ["original$1", '"an-original2"'], 1408 ["original$2", '"an-original3"'], 1409 "root()", 1410 ]); 1411 } 1412 } 1413 1414 async function testESModulesCJS(dbg) { 1415 await breakpointScopes( 1416 dbg, 1417 "webpack3", 1418 "esmodules-cjs", 1419 { line: 20, column: 1 }, 1420 [ 1421 "Block", 1422 ["<this>", "Window"], 1423 ["arguments", "Arguments"], 1424 runtimeFunctionName("webpack3", "esmodules-cjs"), 1425 "__webpack_exports__", 1426 "__WEBPACK_IMPORTED_MODULE_0__src_mod1__", 1427 "__WEBPACK_IMPORTED_MODULE_1__src_mod2__", 1428 "__WEBPACK_IMPORTED_MODULE_10__src_optimized_out__", 1429 "__WEBPACK_IMPORTED_MODULE_2__src_mod3__", 1430 "__WEBPACK_IMPORTED_MODULE_3__src_mod4__", 1431 "__WEBPACK_IMPORTED_MODULE_4__src_mod5__", 1432 "__WEBPACK_IMPORTED_MODULE_5__src_mod6__", 1433 "__WEBPACK_IMPORTED_MODULE_6__src_mod7__", 1434 "__WEBPACK_IMPORTED_MODULE_7__src_mod9__", 1435 "__WEBPACK_IMPORTED_MODULE_8__src_mod10__", 1436 "__WEBPACK_IMPORTED_MODULE_9__src_mod11__", 1437 "__webpack_require__", 1438 "arguments", 1439 "example", 1440 "module", 1441 "root()", 1442 ] 1443 ); 1444 1445 await breakpointScopes( 1446 dbg, 1447 "webpack4", 1448 "esmodules-cjs", 1449 { line: 20, column: 1 }, 1450 [ 1451 "Block", 1452 ["<this>", "Window"], 1453 ["arguments", "Arguments"], 1454 runtimeFunctionName("webpack4", "esmodules-cjs"), 1455 "__webpack_exports__", 1456 "__webpack_require__", 1457 "_src_mod1__WEBPACK_IMPORTED_MODULE_0__", 1458 "_src_mod10__WEBPACK_IMPORTED_MODULE_8__", 1459 "_src_mod11__WEBPACK_IMPORTED_MODULE_9__", 1460 "_src_mod2__WEBPACK_IMPORTED_MODULE_1__", 1461 "_src_mod3__WEBPACK_IMPORTED_MODULE_2__", 1462 "_src_mod4__WEBPACK_IMPORTED_MODULE_3__", 1463 "_src_mod5__WEBPACK_IMPORTED_MODULE_4__", 1464 "_src_mod6__WEBPACK_IMPORTED_MODULE_5__", 1465 "_src_mod7__WEBPACK_IMPORTED_MODULE_6__", 1466 "_src_mod9__WEBPACK_IMPORTED_MODULE_7__", 1467 "_src_optimized_out__WEBPACK_IMPORTED_MODULE_10__", 1468 "arguments", 1469 "example()", 1470 "module", 1471 "root()", 1472 ] 1473 ); 1474 1475 // CJS does not work on Rollup. 1476 for (const target of [ 1477 "parcel", 1478 "webpack3-babel6", 1479 "webpack3-babel7", 1480 "webpack4-babel6", 1481 "webpack4-babel7", 1482 ]) { 1483 await breakpointScopes( 1484 dbg, 1485 target, 1486 "esmodules-cjs", 1487 { line: 20, column: 3 }, 1488 [ 1489 "Module", 1490 ["aDefault", '"a-default"'], 1491 ["aDefault2", '"a-default2"'], 1492 ["aDefault3", '"a-default3"'], 1493 ["anAliased", '"an-original"'], 1494 ["anAliased2", '"an-original2"'], 1495 ["anAliased3", '"an-original3"'], 1496 ["aNamed", '"a-named"'], 1497 ["aNamed2", '"a-named2"'], 1498 ["aNamed3", '"a-named3"'], 1499 ["aNamespace", "{\u2026}"], 1500 ["anotherNamed", '"a-named"'], 1501 ["anotherNamed2", '"a-named2"'], 1502 ["anotherNamed3", '"a-named3"'], 1503 ["example", "(optimized away)"], 1504 ["optimizedOut", "(optimized away)"], 1505 "root()", 1506 ] 1507 ); 1508 } 1509 } 1510 1511 async function testESModulesES6(dbg) { 1512 await breakpointScopes( 1513 dbg, 1514 "webpack3", 1515 "esmodules-es6", 1516 { line: 20, column: 1 }, 1517 [ 1518 "Block", 1519 ["<this>", "Window"], 1520 ["arguments", "Arguments"], 1521 runtimeFunctionName("webpack3", "esmodules-es6"), 1522 "__webpack_exports__", 1523 "__WEBPACK_IMPORTED_MODULE_0__src_mod1__", 1524 "__WEBPACK_IMPORTED_MODULE_1__src_mod2__", 1525 "__WEBPACK_IMPORTED_MODULE_10__src_optimized_out__", 1526 "__WEBPACK_IMPORTED_MODULE_2__src_mod3__", 1527 "__WEBPACK_IMPORTED_MODULE_3__src_mod4__", 1528 "__WEBPACK_IMPORTED_MODULE_4__src_mod5__", 1529 "__WEBPACK_IMPORTED_MODULE_5__src_mod6__", 1530 "__WEBPACK_IMPORTED_MODULE_6__src_mod7__", 1531 "__WEBPACK_IMPORTED_MODULE_7__src_mod9__", 1532 "__WEBPACK_IMPORTED_MODULE_8__src_mod10__", 1533 "__WEBPACK_IMPORTED_MODULE_9__src_mod11__", 1534 "__webpack_require__", 1535 "arguments", 1536 "example", 1537 "module", 1538 "root()", 1539 ] 1540 ); 1541 1542 await breakpointScopes( 1543 dbg, 1544 "webpack4", 1545 "esmodules-es6", 1546 { line: 20, column: 1 }, 1547 [ 1548 "Block", 1549 ["<this>", "Window"], 1550 ["arguments", "Arguments"], 1551 runtimeFunctionName("webpack4", "esmodules-es6"), 1552 "__webpack_exports__", 1553 "__webpack_require__", 1554 "_src_mod1__WEBPACK_IMPORTED_MODULE_0__", 1555 "_src_mod10__WEBPACK_IMPORTED_MODULE_8__", 1556 "_src_mod11__WEBPACK_IMPORTED_MODULE_9__", 1557 "_src_mod2__WEBPACK_IMPORTED_MODULE_1__", 1558 "_src_mod3__WEBPACK_IMPORTED_MODULE_2__", 1559 "_src_mod4__WEBPACK_IMPORTED_MODULE_3__", 1560 "_src_mod5__WEBPACK_IMPORTED_MODULE_4__", 1561 "_src_mod6__WEBPACK_IMPORTED_MODULE_5__", 1562 "_src_mod7__WEBPACK_IMPORTED_MODULE_6__", 1563 "_src_mod9__WEBPACK_IMPORTED_MODULE_7__", 1564 "_src_optimized_out__WEBPACK_IMPORTED_MODULE_10__", 1565 "arguments", 1566 "example()", 1567 "module", 1568 "root()", 1569 ] 1570 ); 1571 1572 for (const target of [ 1573 "parcel", 1574 "rollup", 1575 "webpack3-babel6", 1576 "webpack3-babel7", 1577 "webpack4-babel6", 1578 "webpack4-babel7", 1579 ]) { 1580 const { defaultExport, webpack4ImportGetter, maybeLineStart } = 1581 targetToFlags(target); 1582 1583 await breakpointScopes( 1584 dbg, 1585 target, 1586 "esmodules-es6", 1587 { line: 20, column: maybeLineStart(3) }, 1588 [ 1589 "Module", 1590 ["aDefault", '"a-default"'], 1591 ["aDefault2", '"a-default2"'], 1592 ["aDefault3", '"a-default3"'], 1593 ["anAliased", webpack4ImportGetter || '"an-original"'], 1594 ["anAliased2", webpack4ImportGetter || '"an-original2"'], 1595 ["anAliased3", webpack4ImportGetter || '"an-original3"'], 1596 ["aNamed", webpack4ImportGetter || '"a-named"'], 1597 ["aNamed2", webpack4ImportGetter || '"a-named2"'], 1598 ["aNamed3", webpack4ImportGetter || '"a-named3"'], 1599 ["aNamespace", "{\u2026}"], 1600 ["anotherNamed", webpack4ImportGetter || '"a-named"'], 1601 ["anotherNamed2", webpack4ImportGetter || '"a-named2"'], 1602 ["anotherNamed3", webpack4ImportGetter || '"a-named3"'], 1603 defaultExport("example"), 1604 ["optimizedOut", "(optimized away)"], 1605 "root()", 1606 ] 1607 ); 1608 } 1609 1610 for (const target of ["rollup-babel6", "rollup-babel7"]) { 1611 // This test currently bails out because Babel does not map function calls 1612 // fully and includes the () of the call in the range of the identifier. 1613 // this means that Rollup, has to map locations for calls to imports, 1614 // it can fail. This will be addressed in Babel eventually. 1615 await breakpointScopes( 1616 dbg, 1617 target, 1618 "esmodules-es6", 1619 { line: 20, column: 3 }, 1620 [ 1621 "root", 1622 ["<this>", "Window"], 1623 ["arguments", "Arguments"], 1624 1625 "Block", 1626 ["aNamed", '"a-named"'], 1627 ["aNamed$1", "undefined"], 1628 ["aNamed2", '"a-named2"'], 1629 ["aNamed3", '"a-named3"'], 1630 ["original", '"an-original"'], 1631 ["original$1", '"an-original2"'], 1632 ["original$2", '"an-original3"'], 1633 1634 runtimeFunctionName(target, "esmodules-es6"), 1635 ["aDefault", '"a-default"'], 1636 ["aDefault2", '"a-default2"'], 1637 ["aDefault3", '"a-default3"'], 1638 1639 ["aNamespace", "{\u2026}"], 1640 ["arguments", "(unavailable)"], 1641 ["mod4", "(optimized away)"], 1642 "root()", 1643 ] 1644 ); 1645 } 1646 }