Skip to content

Commit

Permalink
remove sourceMappings
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu committed Oct 2, 2022
1 parent 35e8075 commit fb414d7
Show file tree
Hide file tree
Showing 20 changed files with 16 additions and 377 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"plugins": ["transform-arrow-functions", "transform-function-name"]
"plugins": ["transform-arrow-functions", "transform-function-name"],
"sourceMap": true
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"plugins": ["transform-classes", "transform-block-scoping"]
"plugins": ["transform-classes", "transform-block-scoping"],
"sourceMap": true
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"plugins": ["transform-modules-commonjs"]
"plugins": ["transform-modules-commonjs"],
"sourceMap": true
}

This file was deleted.

15 changes: 1 addition & 14 deletions packages/babel-helper-fixtures/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fs from "fs";
import { fileURLToPath } from "url";
import { createRequire } from "module";
import type { InputOptions } from "@babel/core";
import type { EncodedSourceMap, Mapping } from "@jridgewell/gen-mapping";
import type { EncodedSourceMap } from "@jridgewell/gen-mapping";

const require = createRequire(import.meta.url);

Expand Down Expand Up @@ -39,7 +39,6 @@ export interface Test {
actual: TestFile;
expect: TestFile;
inputSourceMap?: EncodedSourceMap;
sourceMappings?: Mapping[];
sourceMap: string;
sourceMapFile: TestFile;
validateLogs: boolean;
Expand Down Expand Up @@ -194,7 +193,6 @@ function pushTask(
code: readFile(expectLoc),
filename: expectLocAlias,
},
sourceMappings: undefined,
sourceMap: undefined,
sourceMapFile: undefined,
inputSourceMap: undefined,
Expand Down Expand Up @@ -249,11 +247,6 @@ function pushTask(

suite.tests.push(test);

const sourceMappingsLoc = taskDir + "/source-mappings.json";
if (fs.existsSync(sourceMappingsLoc)) {
test.sourceMappings = JSON.parse(readFile(sourceMappingsLoc));
}

const sourceMapLoc = taskDir + "/source-map.json";
if (fs.existsSync(sourceMapLoc)) {
test.sourceMap = JSON.parse(readFile(sourceMapLoc));
Expand All @@ -275,12 +268,6 @@ function pushTask(
"Test cannot throw and also return output code: " + expectLoc,
);
}
if (test.sourceMappings) {
throw new Error(
"Test cannot throw and also return sourcemappings: " +
sourceMappingsLoc,
);
}
if (test.sourceMap) {
throw new Error(
"Test cannot throw and also return sourcemaps: " + sourceMapLoc,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"@babel/core": "workspace:^",
"@babel/helper-check-duplicate-nodes": "workspace:^",
"@babel/helper-fixtures": "workspace:^",
"@jridgewell/trace-mapping": "^0.3.8",
"quick-lru": "5.1.0"
},
"devDependencies": {
Expand Down
12 changes: 0 additions & 12 deletions packages/babel-helper-transform-fixture-test-runner/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
type TaskOptions,
} from "@babel/helper-fixtures";
import { codeFrameColumns } from "@babel/code-frame";
import { TraceMap, originalPositionFor } from "@jridgewell/trace-mapping";
import * as helpers from "./helpers";
import assert from "assert";
import fs from "fs";
Expand Down Expand Up @@ -386,17 +385,6 @@ async function run(task: Test) {
}
}

if (task.sourceMappings) {
const consumer = new TraceMap(result.map);

task.sourceMappings.forEach(function (mapping) {
const actual = mapping.original;

const expected = originalPositionFor(consumer, mapping.generated);
expect({ line: expected.line, column: expected.column }).toEqual(actual);
});
}

if (execCode && resultExec) {
return resultExec;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"plugins": ["transform-destructuring"]
"plugins": ["transform-destructuring"],
"sourceMap": true
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"externalHelpers": true,
"plugins": ["transform-modules-commonjs"]
"plugins": ["transform-modules-commonjs"],
"sourceMap": true
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "sourceMap": true }

0 comments on commit fb414d7

Please sign in to comment.