diff --git a/packages/babel-core/src/transformation/file/generate.ts b/packages/babel-core/src/transformation/file/generate.ts index 4a245daeed56..a0ef5fd06a5e 100644 --- a/packages/babel-core/src/transformation/file/generate.ts +++ b/packages/babel-core/src/transformation/file/generate.ts @@ -16,6 +16,8 @@ export default function generateCode( const { opts, ast, code, inputMap } = file; const { generatorOpts } = opts; + generatorOpts.inputSourceMap = inputMap?.toObject(); + const results = []; for (const plugins of pluginPasses) { for (const plugin of plugins) { @@ -30,11 +32,7 @@ export default function generateCode( let result; if (results.length === 0) { - result = generate( - ast, - { ...generatorOpts, inputSourceMap: inputMap?.toObject() }, - code, - ); + result = generate(ast, generatorOpts, code); } else if (results.length === 1) { result = results[0]; diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/arrow-function/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/arrow-function/source-map.json index e4e51810ff8a..aa7b3e90b2b5 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/arrow-function/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/arrow-function/source-map.json @@ -10,5 +10,5 @@ "sourcesContent": [ "var t = x => x * x;" ], - "mappings": "AAAA,IAAIA,CAAC,GAAG,SAAJA,CAAC,CAAGC,CAAC;EAAA,OAAIA,CAAC,GAAGA,CAAC;AAAA" + "mappings": "AAAA,IAAIA,CAAC,GAAG,SAAJA,CAACA,CAAGC,CAAC;EAAA,OAAIA,CAAC,GAAGA,CAAC;AAAA" } \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/class/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/class/source-map.json index 66ef4d8bac33..7bcd3e9de1d7 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/class/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/class/source-map.json @@ -2,6 +2,11 @@ "version": 3, "names": [ "Test", + "babelHelpers", + "classCallCheck", + "createClass", + "key", + "get", "Error", "test", "bar" @@ -12,5 +17,5 @@ "sourcesContent": [ "class Test {\n get bar() {\n throw new Error(\"wow\");\n }\n}\n\nvar test = new Test;\ntest.bar;" ], - "mappings": "IAAMA,IAAI;EAAA;;EAAA;IAAA;EAAA;EAAA;IAAA;IAAA,KACR,YAAU;MACR,MAAM,IAAIC,KAAK,CAAC,KAAK,CAAC;IACxB;EAAC;EAAA;AAAA;AAGH,IAAIC,IAAI,GAAG,IAAIF,IAAI;AACnBE,IAAI,CAACC,GAAG" + "mappings": "IAAMA,IAAI;EAAA;;EAAA,SAAAA,KAAA;IAAAC,YAAA,CAAAC,cAAA,OAAAF,IAAA;EAAA;EAAAC,YAAA,CAAAE,WAAA,CAAAH,IAAA;IAAAI,GAAA;IAAAC,GAAA,EACR,SAAAA,CAAA,EAAU;MACR,MAAM,IAAIC,KAAK,CAAC,KAAK,CAAC;IACxB;EAAC;EAAA,OAAAN,IAAA;AAAA;AAGH,IAAIO,IAAI,GAAG,IAAIP,IAAI;AACnBO,IAAI,CAACC,GAAG" } \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-map.json index 2aab281b3b1b..56dfd768ed08 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-complex/source-map.json @@ -1,16 +1,15 @@ { "version": 3, - "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsFA;EACAA;EACAC;IACA;MACAC;IACA;EACA;AACA", "names": [ "name", "data", "msg" ], - "sourceRoot": "src/components", "sources": [ - "HelloWorld.vue" + "src/components/HelloWorld.vue" ], "sourcesContent": [ "\n\n\n\n\n\n" - ] + ], + "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAsFA;EACAA,IAAA;EACAC,KAAA;IACA;MACAC,GAAA;IACA;EACA;AACA,G" } \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json index 1b9392bc5377..aa80cf5ef409 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-external/source-map.json @@ -1,11 +1,13 @@ { "version": 3, - "mappings": "AAAA,UAAU,Y;SAAM,C;CAAC", - "names": [], + "names": [ + "foo" + ], "sources": [ "original.js" ], "sourcesContent": [ "var foo = () => 4;" - ] + ], + "mappings": "AAAA,IAAAA,GAAA,GAAU,SAAAA,CAAA,E;SAAM,C;CAAC" } \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources-complete-replace/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources-complete-replace/source-map.json index 050799fd70f9..a5f1938f9f60 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources-complete-replace/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources-complete-replace/source-map.json @@ -1,13 +1,17 @@ { "version": 3, - "mappings": "AAAC,KAAG;ACAJ,KAAG", "names": [], "sources": [ + "input.tsx", + "source-maps/input-source-map-multiple-output-sources-complete-replace/input.js", "bar.js", "baz.js" ], "sourcesContent": [ + "foo(1);\nfunction foo(bar: number): never {\n throw new Error('Intentional.');\n}", + "foo(1);\nfunction foo(bar) {\n throw new Error('Intentional.');\n}\n//# sourceMappingURL=input.js.map", "", "baz();" - ] + ], + "mappings": "AAAA,KAAI;AAAJ,KAAG" } \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources/source-map.json index fd627dac5f6b..2a794dfd9964 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-multiple-output-sources/source-map.json @@ -1,17 +1,19 @@ { "version": 3, - "mappings": "AAAC,KAAG;ACCJ,SAASA,GAAG,CAACC,GAAW;EACpB,MAAM,IAAIC,KAAK,CAAC,cAAc,CAAC;AACnC", "names": [ "foo", "bar", "Error" ], "sources": [ - "test.js", - "input.tsx" + "input.tsx", + "source-maps/input-source-map-multiple-output-sources/input.js", + "test.js" ], "sourcesContent": [ - "", - "foo(1);\nfunction foo(bar: number): never {\n throw new Error('Intentional.');\n}" - ] + "foo(1);\nfunction foo(bar: number): never {\n throw new Error('Intentional.');\n}", + "foo(1);\nfunction foo(bar) {\n throw new Error('Intentional.');\n}\n//# sourceMappingURL=input.js.map", + "" + ], + "mappings": "AAAA,KAAI;AACJ,SAASA,GAAGA,CAACC,GAAW;EACpB,MAAM,IAAIC,KAAK,CAAC,cAAc,CAAC;AACnC" } \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-same-location/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-same-location/source-map.json index 0dde70b60b7c..c90ac92dd77c 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-same-location/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-same-location/source-map.json @@ -1,11 +1,13 @@ { "version": 3, - "mappings": "AAAA,UAAU,Y;SAAM,C;CAAC", - "names": [], + "names": [ + "foo" + ], "sources": [ "source-maps/input-source-map-same-location/input.js" ], "sourcesContent": [ "var foo = () => 4;" - ] + ], + "mappings": "AAAA,IAAAA,GAAA,GAAU,SAAAA,CAAA,E;SAAM,C;CAAC" } \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-sources-complete-replace/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-sources-complete-replace/source-map.json index 4a26e2136a38..eb6d4a8e5c3e 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-sources-complete-replace/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map-sources-complete-replace/source-map.json @@ -1,11 +1,15 @@ { "version": 3, - "mappings": "AAAC,KAAG", "names": [], "sources": [ + "input.tsx", + "source-maps/input-source-map-sources-complete-replace/input.js", "test.js" ], "sourcesContent": [ + "foo(1);\nfunction foo(bar: number): never {\n throw new Error('Intentional.');\n}", + "foo(1);\nfunction foo(bar) {\n throw new Error('Intentional.');\n}\n//# sourceMappingURL=input.js.map", "" - ] + ], + "mappings": "AAAA,KAAI" } \ No newline at end of file diff --git a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json index 1b9392bc5377..aa80cf5ef409 100644 --- a/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json +++ b/packages/babel-core/test/fixtures/transformation/source-maps/input-source-map/source-map.json @@ -1,11 +1,13 @@ { "version": 3, - "mappings": "AAAA,UAAU,Y;SAAM,C;CAAC", - "names": [], + "names": [ + "foo" + ], "sources": [ "original.js" ], "sourcesContent": [ "var foo = () => 4;" - ] + ], + "mappings": "AAAA,IAAAA,GAAA,GAAU,SAAAA,CAAA,E;SAAM,C;CAAC" } \ No newline at end of file diff --git a/packages/babel-generator/src/buffer.ts b/packages/babel-generator/src/buffer.ts index 5780920d2481..9637b0da7a19 100644 --- a/packages/babel-generator/src/buffer.ts +++ b/packages/babel-generator/src/buffer.ts @@ -42,6 +42,7 @@ export default class Buffer { _last = 0; _queue: QueueItem[] = []; _queueCursor = 0; + _canMarkIdName = true; _position = { line: 1, @@ -226,8 +227,10 @@ export default class Buffer { this._position.column = 0; } - sourcePos.identifierName = undefined; - sourcePos.identifierNamePos = undefined; + if (this._canMarkIdName) { + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } } _append( @@ -257,7 +260,10 @@ export default class Buffer { const { column, identifierName, identifierNamePos, filename } = sourcePos; let line = sourcePos.line; - if (identifierName != null || identifierNamePos != null) { + if ( + (identifierName != null || identifierNamePos != null) && + this._canMarkIdName + ) { sourcePos.identifierName = undefined; sourcePos.identifierNamePos = undefined; } @@ -407,9 +413,20 @@ export default class Buffer { if (!this._map) return cb(); this.source("start", loc); - + // @ts-expect-error identifierName is not defined + const identifierName = loc.identifierName; + const sourcePos = this._sourcePosition; + if (identifierName) { + this._canMarkIdName = false; + sourcePos.identifierName = identifierName; + } cb(); + if (identifierName) { + this._canMarkIdName = true; + sourcePos.identifierName = undefined; + sourcePos.identifierNamePos = undefined; + } this.source("end", loc); } diff --git a/packages/babel-generator/src/generators/methods.ts b/packages/babel-generator/src/generators/methods.ts index 1dd9f7b45ac1..e6beb1770440 100644 --- a/packages/babel-generator/src/generators/methods.ts +++ b/packages/babel-generator/src/generators/methods.ts @@ -1,12 +1,15 @@ import type Printer from "../printer"; import type * as t from "@babel/types"; import { isIdentifier } from "@babel/types"; +import type { NodePath } from "@babel/traverse"; export function _params( this: Printer, node: t.Function | t.TSDeclareMethod | t.TSDeclareFunction, - idNode: t.Node, - parentNode: t.Node, + idNode: t.Expression | t.PrivateName, + parentNode: NodePath< + t.Function | t.TSDeclareMethod | t.TSDeclareFunction + >["parent"], ) { this.print(node.typeParameters, node); @@ -141,7 +144,9 @@ export function _predicate( export function _functionHead( this: Printer, node: t.FunctionDeclaration | t.FunctionExpression | t.TSDeclareFunction, - parent: t.Node, + parent: NodePath< + t.FunctionDeclaration | t.FunctionExpression | t.TSDeclareFunction + >["parent"], ) { if (node.async) { this.word("async"); @@ -174,7 +179,7 @@ export function _functionHead( export function FunctionExpression( this: Printer, node: t.FunctionExpression, - parent: t.Node, + parent: NodePath["parent"], ) { this._functionHead(node, parent); this.space(); @@ -186,7 +191,7 @@ export { FunctionExpression as FunctionDeclaration }; export function ArrowFunctionExpression( this: Printer, node: t.ArrowFunctionExpression, - parent: t.Node, + parent: NodePath["parent"], ) { if (node.async) { this.word("async", true); @@ -236,14 +241,25 @@ function hasTypesOrComments( ); } -function _getFuncIdName(this: Printer, idNode: t.Node, parent: t.Node) { - let id = idNode; +function _getFuncIdName( + this: Printer, + idNode: t.Expression | t.PrivateName, + parent: NodePath< + t.Function | t.TSDeclareMethod | t.TSDeclareFunction + >["parent"], +) { + let id: t.Expression | t.PrivateName | t.LVal = idNode; if (!id && parent) { const parentType = parent.type; if (parentType === "VariableDeclarator") { id = parent.id; + } else if ( + parentType === "AssignmentExpression" || + parentType === "AssignmentPattern" + ) { + id = parent.left; } else if ( parentType === "ObjectProperty" || parentType === "ClassProperty" @@ -251,29 +267,35 @@ function _getFuncIdName(this: Printer, idNode: t.Node, parent: t.Node) { if (!parent.computed || parent.key.type === "StringLiteral") { id = parent.key; } + } else if ( + parentType === "ClassPrivateProperty" || + parentType === "ClassAccessorProperty" + ) { + id = parent.key; } } + if (!id) return; + let nameInfo; - if (id) { - if (id.type === "Identifier") { - nameInfo = { - pos: id.loc?.start, - name: - // @ts-expect-error Undocumented property identifierName - id.loc?.identifierName || id.name, - }; - } else if (id.type === "PrivateName") { - nameInfo = { - pos: id.id.loc?.start, - name: id.id.name, - }; - } else if (id.type === "StringLiteral") { - nameInfo = { - pos: id.loc?.start, - name: id.value, - }; - } + + if (id.type === "Identifier") { + nameInfo = { + pos: id.loc?.start, + name: + // @ts-expect-error Undocumented property identifierName + id.loc?.identifierName || id.name, + }; + } else if (id.type === "PrivateName") { + nameInfo = { + pos: id.loc?.start, + name: "#" + id.id.name, + }; + } else if (id.type === "StringLiteral") { + nameInfo = { + pos: id.loc?.start, + name: id.value, + }; } return nameInfo; diff --git a/packages/babel-generator/src/generators/typescript.ts b/packages/babel-generator/src/generators/typescript.ts index a84223f89620..c5585c555bd0 100644 --- a/packages/babel-generator/src/generators/typescript.ts +++ b/packages/babel-generator/src/generators/typescript.ts @@ -1,5 +1,6 @@ import type Printer from "../printer"; import type * as t from "@babel/types"; +import type { NodePath } from "@babel/traverse"; export function TSTypeAnnotation(this: Printer, node: t.TSTypeAnnotation) { this.token(":"); @@ -76,7 +77,7 @@ export function TSParameterProperty( export function TSDeclareFunction( this: Printer, node: t.TSDeclareFunction, - parent: t.Node, + parent: NodePath["parent"], ) { if (node.declare) { this.word("declare"); diff --git a/packages/babel-generator/src/printer.ts b/packages/babel-generator/src/printer.ts index 981f1ffed9d0..582a3452cdc0 100644 --- a/packages/babel-generator/src/printer.ts +++ b/packages/babel-generator/src/printer.ts @@ -369,6 +369,8 @@ class Printer { } sourceIdentifierName(identifierName: string, pos?: Pos): void { + if (!this._buf._canMarkIdName) return; + const sourcePosition = this._buf._sourcePosition; sourcePosition.identifierNamePos = pos; sourcePosition.identifierName = identifierName; diff --git a/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/input.js b/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/input.js index 0dd413c8be1d..5df8f3f4b966 100644 --- a/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/input.js +++ b/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/input.js @@ -26,6 +26,8 @@ class b { ["fn"]() { }; [function() {}]() { }; [()=> {}]() { }; + #x = function() {}; + accessor y = function() {} } var aa = { @@ -53,3 +55,7 @@ var z = () => {}; var z = x => {}; var z = (x) => {}; var z = (x, y, z) => {}; + +x = function() {}; + +( { x = function() {} } = {}); diff --git a/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/options.json b/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/options.json index 219de99ead2d..5a346a8a5cf6 100644 --- a/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/options.json +++ b/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/options.json @@ -1,3 +1,4 @@ { - "sourceMaps": true + "sourceMaps": true, + "plugins": ["decoratorAutoAccessors"] } diff --git a/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/output.js b/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/output.js index 407046bccecf..5d815fb69740 100644 --- a/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/output.js +++ b/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/output.js @@ -23,6 +23,8 @@ class b { ["fn"]() {} [function () {}]() {} [() => {}]() {} + #x = function () {}; + accessor y = function () {}; } var aa = { fn: function a() {}, @@ -44,4 +46,8 @@ var x = function () {}; var z = () => {}; var z = x => {}; var z = x => {}; -var z = (x, y, z) => {}; \ No newline at end of file +var z = (x, y, z) => {}; +x = function () {}; +({ + x = function () {} +} = {}); \ No newline at end of file diff --git a/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/source-map.json b/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/source-map.json index bc36c652b42a..e32aa61af2c3 100644 --- a/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/source-map.json +++ b/packages/babel-generator/test/fixtures/sourcemaps/function-identifier-name/source-map.json @@ -4,17 +4,18 @@ "fn", "a", "b", + "x", + "#x", + "y", "aa", "bb", - "x", - "z", - "y" + "z" ], "sources": [ "fixtures/sourcemaps/function-identifier-name/input.js" ], "sourcesContent": [ - "function fn() {}\n\nexport default function () {}\n\nvar a = {\n fn() {},\n fn:function() {},\n [fn]:function() {},\n [\"fn\"]:function() {},\n [function() {}]:function() {},\n [()=> {}]:function() {},\n [fn]() { },\n [\"fn\"]() { },\n [function() {}]() { },\n [()=> {}]() { }\n}\n\nclass b {\n fn() {};\n fn=function() {};\n [fn]=function() {};\n [\"fn\"]=function() {};\n [function() {}]=function() {};\n [()=> {}]=function() {};\n [fn]() { };\n [\"fn\"]() { };\n [function() {}]() { };\n [()=> {}]() { };\n}\n\nvar aa = {\n fn:function a() {},\n [fn]:function a() {},\n [\"fn\"]:function a() {},\n [function() {}]:function a() {},\n [()=> {}]:function a() {},\n}\n\nclass bb {\n fn=function a() {};\n [fn]=function a() {};\n [\"fn\"]=function a() {};\n [function() {}]=function a() {};\n [()=> {}]=function a() {};\n}\n\nvar x = function fn() {};\nvar x = function () {};\n\n(function fn() {});\n\nvar z = () => {};\nvar z = x => {};\nvar z = (x) => {};\nvar z = (x, y, z) => {};" + "function fn() {}\n\nexport default function () {}\n\nvar a = {\n fn() {},\n fn:function() {},\n [fn]:function() {},\n [\"fn\"]:function() {},\n [function() {}]:function() {},\n [()=> {}]:function() {},\n [fn]() { },\n [\"fn\"]() { },\n [function() {}]() { },\n [()=> {}]() { }\n}\n\nclass b {\n fn() {};\n fn=function() {};\n [fn]=function() {};\n [\"fn\"]=function() {};\n [function() {}]=function() {};\n [()=> {}]=function() {};\n [fn]() { };\n [\"fn\"]() { };\n [function() {}]() { };\n [()=> {}]() { };\n #x = function() {};\n accessor y = function() {}\n}\n\nvar aa = {\n fn:function a() {},\n [fn]:function a() {},\n [\"fn\"]:function a() {},\n [function() {}]:function a() {},\n [()=> {}]:function a() {},\n}\n\nclass bb {\n fn=function a() {};\n [fn]=function a() {};\n [\"fn\"]=function a() {};\n [function() {}]=function a() {};\n [()=> {}]=function a() {};\n}\n\nvar x = function fn() {};\nvar x = function () {};\n\n(function fn() {});\n\nvar z = () => {};\nvar z = x => {};\nvar z = (x) => {};\nvar z = (x, y, z) => {};\n\nx = function() {};\n\n( { x = function() {} } = {});" ], - "mappings": "AAAA,SAASA,EAAEA,CAAA,EAAG,CAAC;AAEf,eAAe,YAAY,CAAC;AAE5B,IAAIC,CAAC,GAAG;EACND,EAAEA,CAAA,EAAG,CAAC,CAAC;EACPA,EAAE,EAAC,SAAAA,CAAA,EAAW,CAAC,CAAC;EAChB,CAACA,EAAE,GAAE,YAAW,CAAC,CAAC;EAClB,CAAC,IAAI,GAAE,SAAAA,CAAA,EAAW,CAAC,CAAC;EACpB,CAAC,YAAW,CAAC,CAAC,GAAE,YAAW,CAAC,CAAC;EAC7B,CAAC,MAAK,C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A,CAAA,EAAG,CAAC,CAAC;AACxB,IAAIG,CAAC,GAAG,SAAAA,CAAA,EAAY,CAAC,CAAC;AAEtB,CAAC,SAASH,EAAEA,CAAA,EAAG,CAAC,CAAC;AAEjB,IAAIQ,CAAC,GAAGA,CAAA,KAAM,CAAC,CAAC;AAChB,IAAIA,CAAC,GAAGL,CAAC,IAAI,CAAC,CAAC;AACf,IAAIK,CAAC,GAAIL,CAAC,IAAK,CAAC,CAAC;AACjB,IAAIK,CAAC,GAAGA,CAACL,CAAC,EAAEE,CAAC,EAAEG,CAAC,KAAK,CAAC,CAAC;AAEvBL,CAAC,GAAG,SAAAA,CAAA,EAAW,CAAC,CAAC;AAEjB,CAAE;EAAEA,CAAC,GAAG,SAAAA,CAAA,EAAW,CAAC;AAAE,CAAC,GAAG,CAAC,CAAC" } \ No newline at end of file diff --git a/packages/babel-plugin-transform-destructuring/test/fixtures/sourcemap/declaration-loc/source-map.json b/packages/babel-plugin-transform-destructuring/test/fixtures/sourcemap/declaration-loc/source-map.json index d96b0adc9d41..7fffb459d0b2 100644 --- a/packages/babel-plugin-transform-destructuring/test/fixtures/sourcemap/declaration-loc/source-map.json +++ b/packages/babel-plugin-transform-destructuring/test/fixtures/sourcemap/declaration-loc/source-map.json @@ -3,6 +3,9 @@ "names": [ "fn", "arg", + "_arg", + "babelHelpers", + "slicedToArray", "x", "y" ], @@ -12,5 +15,5 @@ "sourcesContent": [ "const fn = (arg) => {\n var [x, y] = arg;\n}" ], - "mappings": "AAAA,MAAMA,EAAE,GAAIC,GAAG,IAAK;EAClB,sCAAaA,GAAG;IAAXC,CAAC;IAAEC,CAAC;AACX,CAAC" + "mappings": "AAAA,MAAMA,EAAE,GAAIC,GAAG,IAAK;EAClB,IAAAC,IAAA,GAAAC,YAAA,CAAAC,aAAA,CAAaH,GAAG;IAAXI,CAAC,GAAAH,IAAA;IAAEI,CAAC,GAAAJ,IAAA;AACX,CAAC" } \ No newline at end of file diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/reference-source-map/source-map.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/reference-source-map/source-map.json index a9eb1ff49e4c..9d2baa976ddc 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/reference-source-map/source-map.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/misc/reference-source-map/source-map.json @@ -1,12 +1,19 @@ { "version": 3, "names": [ + "_one", + "babelHelpers", + "interopRequireDefault", + "require", + "_two", + "_three", + "aNamespace", + "interopRequireWildcard", "console", "log", "aDefault", "aNamed", - "anAliased", - "aNamespace" + "anAliased" ], "sources": [ "misc/reference-source-map/input.mjs" @@ -14,5 +21,5 @@ "sourcesContent": [ "import aDefault from \"one\";\nimport { aNamed } from \"two\";\nimport { orig as anAliased } from \"three\";\nimport * as aNamespace from \"four\";\n\nconsole.log(aDefault);\nconsole.log(aNamed);\nconsole.log(anAliased);\nconsole.log(aNamespace);\n\nconsole.log(aDefault());\nconsole.log(aNamed());\nconsole.log(anAliased());\nconsole.log(aNamespace());" ], - "mappings": ";;AAAA;AACA;AACA;AACA;AAEAA,OAAO,CAACC,GAAG,CAACC,YAAQ,CAAC;AACrBF,OAAO,CAACC,GAAG,CAACE,WAAM,CAAC;AACnBH,OAAO,CAACC,GAAG,CAACG,WAAS,CAAC;AACtBJ,OAAO,CAACC,GAAG,CAACI,UAAU,CAAC;AAEvBL,OAAO,CAACC,GAAG,CAAC,IAAAC,YAAQ,GAAE,CAAC;AACvBF,OAAO,CAACC,GAAG,CAAC,IAAAE,WAAM,GAAE,CAAC;AACrBH,OAAO,CAACC,GAAG,CAAC,IAAAG,WAAS,GAAE,CAAC;AACxBJ,OAAO,CAACC,GAAG,CAACI,UAAU,EAAE,CAAC" + "mappings": ";;AAAA,IAAAA,IAAA,GAAAC,YAAA,CAAAC,qBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAL,YAAA,CAAAM,sBAAA,CAAAJ,OAAA;AAEAK,OAAO,CAACC,GAAG,CAACC,YAAQ,CAAC;AACrBF,OAAO,CAACC,GAAG,CAACE,WAAM,CAAC;AACnBH,OAAO,CAACC,GAAG,CAACG,WAAS,CAAC;AACtBJ,OAAO,CAACC,GAAG,CAACH,UAAU,CAAC;AAEvBE,OAAO,CAACC,GAAG,CAAC,IAAAC,YAAQ,GAAE,CAAC;AACvBF,OAAO,CAACC,GAAG,CAAC,IAAAE,WAAM,GAAE,CAAC;AACrBH,OAAO,CAACC,GAAG,CAAC,IAAAG,WAAS,GAAE,CAAC;AACxBJ,OAAO,CAACC,GAAG,CAACH,UAAU,EAAE,CAAC" } \ No newline at end of file diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/source-map.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/source-map.json index 1d9088e54ebe..bddb0ee0073b 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/source-map.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/source-map.json @@ -1,6 +1,10 @@ { "version": 3, "names": [ + "foo4", + "babelHelpers", + "interopRequireWildcard", + "require", "foo", "foo2", "foo3" @@ -11,5 +15,5 @@ "sourcesContent": [ "import foo from \"foo\";\nimport { default as foo2 } from \"foo\";\nimport { foo3 } from \"foo\";\nimport * as foo4 from \"foo\";\n\nfoo;\nfoo2;\nfoo3;\nfoo3();\nfoo3``;\nfoo3?.();" ], - "mappings": ";;AAAA;AAKAA,YAAG;AACHC,YAAI;AACJC,SAAI;AACJ,IAAAA,SAAI,GAAE;AACN,IAAAA,SAAI,CAAC,EAAC;AACN,IAAAA,SAAI,KAAI" + "mappings": ";;AAAA,IAAAA,IAAA,GAAAC,YAAA,CAAAC,sBAAA,CAAAC,OAAA;AAKAC,YAAG;AACHC,YAAI;AACJC,SAAI;AACJ,IAAAA,SAAI,GAAE;AACN,IAAAA,SAAI,CAAC,EAAC;AACN,IAAAA,SAAI,KAAI" } \ No newline at end of file diff --git a/packages/babel-plugin-transform-react-jsx/test/fixtures/sourcemaps/JSXText/source-map.json b/packages/babel-plugin-transform-react-jsx/test/fixtures/sourcemaps/JSXText/source-map.json index 1afb281ac7e1..7b8331ef3b8a 100644 --- a/packages/babel-plugin-transform-react-jsx/test/fixtures/sourcemaps/JSXText/source-map.json +++ b/packages/babel-plugin-transform-react-jsx/test/fixtures/sourcemaps/JSXText/source-map.json @@ -2,7 +2,9 @@ "version": 3, "names": [ "React", - "App" + "App", + "createElement", + "className" ], "sources": [ "sourcemaps/JSXText/input.js" @@ -10,5 +12,5 @@ "sourcesContent": [ "import React from 'react';\n\nexport default function App() {\n return (\n
\n

Welcome to my application!

\n This is my app!\n MINE.\n
\n )\n}" ], - "mappings": "AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,eAAe,SAASC,GAAG,GAAG;EAC5B,oBACE;IAAK,SAAS,EAAC;EAAK,gBAClB,gCAAI,4BAA0B,CAAK,mBAEnC,mDAAQ,OAAK,CAAS,CAClB;AAEV" + "mappings": "AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,eAAe,SAASC,GAAGA,CAAA,EAAG;EAC5B,oBACED,KAAA,CAAAE,aAAA;IAAKC,SAAS,EAAC;EAAK,gBAClBH,KAAA,CAAAE,aAAA,aAAI,4BAA0B,CAAK,mBAEnC,eAAAF,KAAA,CAAAE,aAAA,iBAAQ,OAAK,CAAS,CAClB;AAEV" } \ No newline at end of file diff --git a/packages/babel-traverse/test/fixtures/conversion/arguments-source-maps/source-map.json b/packages/babel-traverse/test/fixtures/conversion/arguments-source-maps/source-map.json index 74b54b5bf881..2cbf176f834f 100644 --- a/packages/babel-traverse/test/fixtures/conversion/arguments-source-maps/source-map.json +++ b/packages/babel-traverse/test/fixtures/conversion/arguments-source-maps/source-map.json @@ -2,10 +2,11 @@ "version": 3, "names": [ "fn", + "_arguments", + "arguments", "inner", "console", - "log", - "arguments" + "log" ], "sources": [ "conversion/arguments-source-maps/input.js" @@ -13,5 +14,5 @@ "sourcesContent": [ "function fn() {\n var inner = () => {\n console.log(arguments);\n };\n}" ], - "mappings": "AAAA,SAASA,EAAE,GAAG;EAAA;EACZ,IAAIC,KAAK,GAAG,YAAM;IAChBC,OAAO,CAACC,GAAG,CAACC,UAAS,CAAC;EACxB,CAAC;AACH" + "mappings": "AAAA,SAASA,EAAEA,CAAA,EAAG;EAAA,IAAAC,UAAA,GAAAC,SAAA;EACZ,IAAIC,KAAK,GAAG,SAAAA,CAAA,EAAM;IAChBC,OAAO,CAACC,GAAG,CAACH,UAAS,CAAC;EACxB,CAAC;AACH" } \ No newline at end of file diff --git a/packages/babel-traverse/test/fixtures/conversion/this-source-maps/source-map.json b/packages/babel-traverse/test/fixtures/conversion/this-source-maps/source-map.json index 70fb45953d9e..9b137b64093e 100644 --- a/packages/babel-traverse/test/fixtures/conversion/this-source-maps/source-map.json +++ b/packages/babel-traverse/test/fixtures/conversion/this-source-maps/source-map.json @@ -2,6 +2,7 @@ "version": 3, "names": [ "fn", + "_this", "inner", "console", "log" @@ -12,5 +13,5 @@ "sourcesContent": [ "function fn() {\n var inner = () => {\n console.log(this);\n };\n}" ], - "mappings": "AAAA,SAASA,EAAE,GAAG;EAAA;EACZ,IAAIC,KAAK,GAAG,YAAM;IAChBC,OAAO,CAACC,GAAG,CAAC,KAAI,CAAC;EACnB,CAAC;AACH" + "mappings": "AAAA,SAASA,EAAEA,CAAA,EAAG;EAAA,IAAAC,KAAA;EACZ,IAAIC,KAAK,GAAG,SAAAA,CAAA,EAAM;IAChBC,OAAO,CAACC,GAAG,CAACH,KAAI,CAAC;EACnB,CAAC;AACH" } \ No newline at end of file