-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add option to output .js files while preserving jsx #13636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
dd0ed44
7879b22
8d590d5
7bf52ee
6fda5a1
ebb666a
0a4632f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//// [es3-jsx-preserve.tsx] | ||
|
||
const React: any = null; | ||
|
||
const elem = <div></div>; | ||
|
||
|
||
|
||
//// [es3-jsx-preserve.jsx] | ||
var React = null; | ||
var elem = <div></div>; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/es3-jsx-preserve.tsx === | ||
|
||
const React: any = null; | ||
>React : Symbol(React, Decl(es3-jsx-preserve.tsx, 1, 5)) | ||
|
||
const elem = <div></div>; | ||
>elem : Symbol(elem, Decl(es3-jsx-preserve.tsx, 3, 5)) | ||
>div : Symbol(unknown) | ||
>div : Symbol(unknown) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
=== tests/cases/compiler/es3-jsx-preserve.tsx === | ||
|
||
const React: any = null; | ||
>React : any | ||
>null : null | ||
|
||
const elem = <div></div>; | ||
>elem : any | ||
><div></div> : any | ||
>div : any | ||
>div : any | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//// [es3-jsx-react-native.tsx] | ||
|
||
const React: any = null; | ||
|
||
const elem = <div></div>; | ||
|
||
|
||
|
||
//// [es3-jsx-react-native.js] | ||
var React = null; | ||
var elem = <div></div>; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/es3-jsx-react-native.tsx === | ||
|
||
const React: any = null; | ||
>React : Symbol(React, Decl(es3-jsx-react-native.tsx, 1, 5)) | ||
|
||
const elem = <div></div>; | ||
>elem : Symbol(elem, Decl(es3-jsx-react-native.tsx, 3, 5)) | ||
>div : Symbol(unknown) | ||
>div : Symbol(unknown) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
=== tests/cases/compiler/es3-jsx-react-native.tsx === | ||
|
||
const React: any = null; | ||
>React : any | ||
>null : null | ||
|
||
const elem = <div></div>; | ||
>elem : any | ||
><div></div> : any | ||
>div : any | ||
>div : any | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//// [es3-jsx-react.tsx] | ||
|
||
const React: any = null; | ||
|
||
const elem = <div></div>; | ||
|
||
|
||
|
||
//// [es3-jsx-react.js] | ||
var React = null; | ||
var elem = React.createElement("div", null); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
=== tests/cases/compiler/es3-jsx-react.tsx === | ||
|
||
const React: any = null; | ||
>React : Symbol(React, Decl(es3-jsx-react.tsx, 1, 5)) | ||
|
||
const elem = <div></div>; | ||
>elem : Symbol(elem, Decl(es3-jsx-react.tsx, 3, 5)) | ||
>div : Symbol(unknown) | ||
>div : Symbol(unknown) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
=== tests/cases/compiler/es3-jsx-react.tsx === | ||
|
||
const React: any = null; | ||
>React : any | ||
>null : null | ||
|
||
const elem = <div></div>; | ||
>elem : any | ||
><div></div> : any | ||
>div : any | ||
>div : any | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
EmitSkipped: false | ||
FileName : /tests/cases/fourslash/inputFile1.js.map | ||
{"version":3,"file":"inputFile1.js","sourceRoot":"","sources":["inputFile1.ts"],"names":[],"mappings":"AAAA,kBAAkB;AACjB,IAAI,CAAC,GAAW,CAAC,CAAC;AAClB;IAAA;IAGA,CAAC;IAAD,UAAC;AAAD,CAAC,AAHD,IAGC"}FileName : /tests/cases/fourslash/inputFile1.js | ||
// regular ts file | ||
var t = 5; | ||
var Bar = (function () { | ||
function Bar() { | ||
} | ||
return Bar; | ||
}()); | ||
//# sourceMappingURL=inputFile1.js.mapFileName : /tests/cases/fourslash/inputFile1.d.ts | ||
declare var t: number; | ||
declare class Bar { | ||
x: string; | ||
y: number; | ||
} | ||
|
||
EmitSkipped: false | ||
FileName : /tests/cases/fourslash/inputFile2.js.map | ||
{"version":3,"file":"inputFile2.js","sourceRoot":"","sources":["inputFile2.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,QAAQ,CAAC;AACjB,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAE,CAAC,CAAC,CAAC,EAAG,CAAA"}FileName : /tests/cases/fourslash/inputFile2.js | ||
var y = "my div"; | ||
var x = <div name={y}/>; | ||
//# sourceMappingURL=inputFile2.js.mapFileName : /tests/cases/fourslash/inputFile2.d.ts | ||
declare var y: string; | ||
declare var x: any; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @target: ES3 | ||
// @sourcemap: false | ||
// @declaration: false | ||
// @jsx: preserve | ||
|
||
const React: any = null; | ||
|
||
const elem = <div></div>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @target: ES3 | ||
// @sourcemap: false | ||
// @declaration: false | ||
// @jsx: react-native | ||
|
||
const React: any = null; | ||
|
||
const elem = <div></div>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// @target: ES3 | ||
// @sourcemap: false | ||
// @declaration: false | ||
// @jsx: react | ||
|
||
const React: any = null; | ||
|
||
const elem = <div></div>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/// <reference path="fourslash.ts" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't be a fourslash test (they are much slower than compiler baselines). See other tests in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other compiler testcases I made after this also test the PR's behaviour, so I suppose I can just delete this fourslash one. |
||
|
||
// @BaselineFile: getEmitOutputTsxFile_ReactNative.baseline | ||
// @declaration: true | ||
// @sourceMap: true | ||
// @jsx: react-native | ||
|
||
// @Filename: inputFile1.ts | ||
// @emitThisFile: true | ||
////// regular ts file | ||
//// var t: number = 5; | ||
//// class Bar { | ||
//// x : string; | ||
//// y : number | ||
//// } | ||
|
||
// @Filename: inputFile2.tsx | ||
// @emitThisFile: true | ||
//// var y = "my div"; | ||
//// var x = <div name= {y} /> | ||
|
||
verify.baselineGetEmitOutput(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you revert the changes to this file, the file is generated as part of the build. you have edited the correct file under src/server/protocol.ts