From bd838ac5a9524c1a7f3db34c2110c6ddb9718de0 Mon Sep 17 00:00:00 2001 From: Austaras Date: Wed, 9 Mar 2022 19:55:31 +0800 Subject: [PATCH] feat(es/minifier): Remove pure calls (#3925) --- ...hildrenCanBeTupleType_es2015.2.minified.js | 1 - ...sxChildrenCanBeTupleType_es5.2.minified.js | 1 - ...JsxChildrenProperty10_es2015.2.minified.js | 6 - ...eckJsxChildrenProperty10_es5.2.minified.js | 3 - ...JsxChildrenProperty11_es2015.2.minified.js | 6 - ...eckJsxChildrenProperty11_es5.2.minified.js | 3 - ...JsxChildrenProperty14_es2015.2.minified.js | 26 +---- ...eckJsxChildrenProperty14_es5.2.minified.js | 26 +---- ...JsxChildrenProperty15_es2015.2.minified.js | 10 +- ...eckJsxChildrenProperty15_es5.2.minified.js | 11 +- ...kJsxChildrenProperty1_es2015.2.minified.js | 16 +-- ...heckJsxChildrenProperty1_es5.2.minified.js | 16 +-- ...kJsxChildrenProperty2_es2015.2.minified.js | 28 +---- ...heckJsxChildrenProperty2_es5.2.minified.js | 29 +---- ...kJsxChildrenProperty5_es2015.2.minified.js | 13 --- ...heckJsxChildrenProperty5_es5.2.minified.js | 13 --- ...kJsxChildrenProperty6_es2015.2.minified.js | 19 ---- ...heckJsxChildrenProperty6_es5.2.minified.js | 19 ---- ...kJsxChildrenProperty7_es2015.2.minified.js | 16 --- ...heckJsxChildrenProperty7_es5.2.minified.js | 16 --- ...kJsxChildrenProperty8_es2015.2.minified.js | 19 ---- ...heckJsxChildrenProperty8_es5.2.minified.js | 19 ---- ...kJsxChildrenProperty9_es2015.2.minified.js | 4 +- ...heckJsxChildrenProperty9_es5.2.minified.js | 5 +- ...gHasCorrectInferences_es2015.2.minified.js | 21 ---- ...cTagHasCorrectInferences_es5.2.minified.js | 29 ----- ...ctionElementPropsType_es2015.2.minified.js | 7 +- ...rsectionElementPropsType_es5.2.minified.js | 2 - ...ipContextSensitiveBug_es2015.2.minified.js | 13 --- ...eSkipContextSensitiveBug_es5.2.minified.js | 23 ---- .../classExpression2_es5.2.minified.js | 8 -- .../classExpressionES62_es5.2.minified.js | 8 -- ...mittingInPreserveJsx1_es2015.2.minified.js | 3 +- ...ntEmittingInPreserveJsx1_es5.2.minified.js | 3 +- ...ralsInJsxAttributes01_es2015.2.minified.js | 11 -- ...iteralsInJsxAttributes01_es5.2.minified.js | 12 -- ...ralsInJsxAttributes02_es2015.2.minified.js | 22 ++-- ...iteralsInJsxAttributes02_es5.2.minified.js | 22 ++-- ...arkAliasAsReferences1_es2015.2.minified.js | 8 +- ...lyMarkAliasAsReferences1_es5.2.minified.js | 8 +- ...arkAliasAsReferences2_es2015.2.minified.js | 8 +- ...lyMarkAliasAsReferences2_es5.2.minified.js | 8 +- ...arkAliasAsReferences3_es2015.2.minified.js | 8 +- ...lyMarkAliasAsReferences3_es5.2.minified.js | 8 +- ...arkAliasAsReferences4_es2015.2.minified.js | 4 +- ...lyMarkAliasAsReferences4_es5.2.minified.js | 4 +- ...rridesCompilerOptions_es2015.2.minified.js | 1 - ...OverridesCompilerOptions_es5.2.minified.js | 1 - ...neJsxAndJsxFragPragma_es2015.2.minified.js | 3 - ...nlineJsxAndJsxFragPragma_es5.2.minified.js | 3 - ...eclarationsLocalTypes_es2015.2.minified.js | 33 ------ ...ryDeclarationsLocalTypes_es5.2.minified.js | 27 +---- ...calTypeGlobalFallback_es2015.2.minified.js | 1 - ...yLocalTypeGlobalFallback_es5.2.minified.js | 1 - ...erridesCompilerOption_es2015.2.minified.js | 1 - ...yOverridesCompilerOption_es5.2.minified.js | 1 - ...ryWithFragmentIsError_es2015.2.minified.js | 2 +- ...ctoryWithFragmentIsError_es5.2.minified.js | 2 +- ...oTypeArgumentsAllowed_es2015.2.minified.js | 5 +- ...sxNoTypeArgumentsAllowed_es5.2.minified.js | 5 +- ...sCjsTransformChildren_es2015.2.minified.js | 2 +- ...JsxsCjsTransformChildren_es5.2.minified.js | 2 +- ...ormCustomImportPragma_es2015.2.minified.js | 17 --- ...nsformCustomImportPragma_es5.2.minified.js | 17 --- ...TransformCustomImport_es2015.2.minified.js | 4 +- ...CjsTransformCustomImport_es5.2.minified.js | 4 +- ...ropCustomImportPragma_es2015.2.minified.js | 12 +- ...eyPropCustomImportPragma_es5.2.minified.js | 12 +- ...rmKeyPropCustomImport_es2015.2.minified.js | 6 +- ...sformKeyPropCustomImport_es5.2.minified.js | 6 +- ...xsCjsTransformKeyProp_es2015.2.minified.js | 6 +- ...xJsxsCjsTransformKeyProp_es5.2.minified.js | 6 +- ...stitutesNamesFragment_es2015.2.minified.js | 2 +- ...SubstitutesNamesFragment_es5.2.minified.js | 2 +- ...sformSubstitutesNames_es2015.2.minified.js | 1 - ...ransformSubstitutesNames_es5.2.minified.js | 1 - .../jsxParsingError4_es2015.2.minified.js | 1 - .../jsxParsingError4_es5.2.minified.js | 1 - .../jsxReactTestSuite_es2015.2.minified.js | 26 ++--- .../jsxReactTestSuite_es5.2.minified.js | 26 ++--- ...writesAttributeStrict_es2015.2.minified.js | 18 +-- ...verwritesAttributeStrict_es5.2.minified.js | 17 ++- .../multiline_es2015.2.minified.js | 15 --- .../multiline_es5.2.minified.js | 15 --- .../tsxAttributeErrors_es2015.2.minified.js | 9 +- .../tsxAttributeErrors_es5.2.minified.js | 9 +- ...AttributeResolution10_es2015.2.minified.js | 7 -- ...tsxAttributeResolution10_es5.2.minified.js | 7 -- ...AttributeResolution11_es2015.2.minified.js | 5 - ...tsxAttributeResolution11_es5.2.minified.js | 3 - ...AttributeResolution12_es2015.2.minified.js | 3 +- ...tsxAttributeResolution12_es5.2.minified.js | 3 +- ...AttributeResolution13_es2015.2.minified.js | 1 - ...tsxAttributeResolution13_es5.2.minified.js | 1 - ...AttributeResolution15_es2015.2.minified.js | 9 -- ...tsxAttributeResolution15_es5.2.minified.js | 11 +- ...AttributeResolution16_es2015.2.minified.js | 5 - ...tsxAttributeResolution16_es5.2.minified.js | 5 - ...xAttributeResolution1_es2015.2.minified.js | 23 ---- .../tsxAttributeResolution1_es5.2.minified.js | 23 ---- ...xAttributeResolution2_es2015.2.minified.js | 7 -- .../tsxAttributeResolution2_es5.2.minified.js | 13 --- ...xAttributeResolution3_es2015.2.minified.js | 16 +-- .../tsxAttributeResolution3_es5.2.minified.js | 16 +-- ...xAttributeResolution4_es2015.2.minified.js | 6 +- .../tsxAttributeResolution4_es5.2.minified.js | 6 +- ...xAttributeResolution6_es2015.2.minified.js | 11 -- .../tsxAttributeResolution6_es5.2.minified.js | 11 -- ...xAttributeResolution7_es2015.2.minified.js | 9 -- .../tsxAttributeResolution7_es5.2.minified.js | 9 -- ...xAttributeResolution8_es2015.2.minified.js | 2 +- .../tsxAttributeResolution8_es5.2.minified.js | 2 +- ...xAttributeResolution9_es2015.2.minified.js | 5 - .../tsxAttributeResolution9_es5.2.minified.js | 5 - ...AttributesResolution1_es2015.2.minified.js | 3 - ...ultAttributesResolution1_es5.2.minified.js | 3 - ...AttributesResolution2_es2015.2.minified.js | 3 - ...ultAttributesResolution2_es5.2.minified.js | 3 - ...AttributesResolution3_es2015.2.minified.js | 3 - ...ultAttributesResolution3_es5.2.minified.js | 3 - .../tsxDynamicTagName1_es2015.2.minified.js | 1 - .../tsxDynamicTagName1_es5.2.minified.js | 1 - .../tsxDynamicTagName2_es2015.2.minified.js | 1 - .../tsxDynamicTagName2_es5.2.minified.js | 1 - .../tsxDynamicTagName3_es2015.2.minified.js | 1 - .../tsxDynamicTagName3_es5.2.minified.js | 1 - .../tsxDynamicTagName4_es2015.2.minified.js | 1 - .../tsxDynamicTagName4_es5.2.minified.js | 1 - .../tsxDynamicTagName6_es2015.2.minified.js | 1 - .../tsxDynamicTagName6_es5.2.minified.js | 1 - ...sxElementResolution10_es2015.2.minified.js | 7 -- .../tsxElementResolution10_es5.2.minified.js | 7 -- ...sxElementResolution11_es2015.2.minified.js | 8 -- .../tsxElementResolution11_es5.2.minified.js | 8 -- ...sxElementResolution12_es2015.2.minified.js | 14 +-- .../tsxElementResolution12_es5.2.minified.js | 14 +-- ...sxElementResolution13_es2015.2.minified.js | 3 - .../tsxElementResolution13_es5.2.minified.js | 3 - ...sxElementResolution14_es2015.2.minified.js | 3 - .../tsxElementResolution14_es5.2.minified.js | 3 - ...sxElementResolution15_es2015.2.minified.js | 4 - .../tsxElementResolution15_es5.2.minified.js | 4 - ...sxElementResolution16_es2015.2.minified.js | 3 - .../tsxElementResolution16_es5.2.minified.js | 3 - ...sxElementResolution17_es2015.2.minified.js | 2 +- .../tsxElementResolution17_es5.2.minified.js | 2 +- ...sxElementResolution18_es2015.2.minified.js | 3 - .../tsxElementResolution18_es5.2.minified.js | 3 - ...sxElementResolution19_es2015.2.minified.js | 1 - .../tsxElementResolution19_es5.2.minified.js | 1 - ...tsxElementResolution1_es2015.2.minified.js | 1 - .../tsxElementResolution1_es5.2.minified.js | 1 - ...tsxElementResolution2_es2015.2.minified.js | 1 - .../tsxElementResolution2_es5.2.minified.js | 1 - ...tsxElementResolution3_es2015.2.minified.js | 5 - .../tsxElementResolution3_es5.2.minified.js | 5 - ...tsxElementResolution4_es2015.2.minified.js | 7 -- .../tsxElementResolution4_es5.2.minified.js | 7 -- ...tsxElementResolution5_es2015.2.minified.js | 3 - .../tsxElementResolution5_es5.2.minified.js | 3 - ...tsxElementResolution6_es2015.2.minified.js | 3 - .../tsxElementResolution6_es5.2.minified.js | 3 - ...tsxElementResolution7_es2015.2.minified.js | 8 +- .../tsxElementResolution7_es5.2.minified.js | 8 +- ...tsxElementResolution8_es2015.2.minified.js | 6 - .../tsxElementResolution8_es5.2.minified.js | 6 - ...tsxElementResolution9_es2015.2.minified.js | 4 - .../tsxElementResolution9_es5.2.minified.js | 4 - .../tsxElementResolution_es2015.2.minified.js | 5 +- .../tsxElementResolution_es5.2.minified.js | 4 +- .../tsxEmit1_es2015.2.minified.js | 26 ----- .../tsc-references/tsxEmit1_es5.2.minified.js | 53 +-------- .../tsxEmit2_es2015.2.minified.js | 8 +- .../tsc-references/tsxEmit2_es5.2.minified.js | 8 +- .../tsxEmit3_es2015.2.minified.js | 4 +- .../tsc-references/tsxEmit3_es5.2.minified.js | 4 +- ...sxExternalModuleEmit2_es2015.2.minified.js | 4 +- .../tsxExternalModuleEmit2_es5.2.minified.js | 4 +- ...xFragmentPreserveEmit_es2015.2.minified.js | 2 +- .../tsxFragmentPreserveEmit_es5.2.minified.js | 2 +- .../tsxFragmentReactEmit_es2015.2.minified.js | 2 +- .../tsxFragmentReactEmit_es5.2.minified.js | 2 +- .../tsxInArrowFunction_es2015.2.minified.js | 13 --- .../tsxInArrowFunction_es5.2.minified.js | 17 --- ...rinsicAttributeErrors_es2015.2.minified.js | 4 - ...IntrinsicAttributeErrors_es5.2.minified.js | 4 - ...raryManagedAttributes_es2015.2.minified.js | 106 ++---------------- ...LibraryManagedAttributes_es5.2.minified.js | 90 +-------------- .../tsxNoJsx_es2015.2.minified.js | 1 - .../tsc-references/tsxNoJsx_es5.2.minified.js | 1 - ...sxOpeningClosingNames_es2015.2.minified.js | 2 +- .../tsxOpeningClosingNames_es5.2.minified.js | 2 +- .../tsxParseTests1_es2015.2.minified.js | 1 - .../tsxParseTests1_es5.2.minified.js | 1 - .../tsxParseTests2_es2015.2.minified.js | 1 - .../tsxParseTests2_es5.2.minified.js | 1 - .../tsxPreserveEmit1_es2015.2.minified.js | 9 +- .../tsxPreserveEmit1_es5.2.minified.js | 6 +- .../tsxPreserveEmit2_es2015.2.minified.js | 2 - .../tsxPreserveEmit2_es5.2.minified.js | 2 - ...DefaultTypeParameter1_es2015.2.minified.js | 6 +- ...ithDefaultTypeParameter1_es5.2.minified.js | 5 +- ...DefaultTypeParameter2_es2015.2.minified.js | 5 +- ...ithDefaultTypeParameter2_es5.2.minified.js | 5 +- ...DefaultTypeParameter3_es2015.2.minified.js | 8 +- ...ithDefaultTypeParameter3_es5.2.minified.js | 8 +- .../tsxReactEmit1_es2015.2.minified.js | 28 ----- .../tsxReactEmit1_es5.2.minified.js | 55 +-------- .../tsxReactEmit2_es2015.2.minified.js | 8 +- .../tsxReactEmit2_es5.2.minified.js | 8 +- .../tsxReactEmit3_es2015.2.minified.js | 1 - .../tsxReactEmit3_es5.2.minified.js | 1 - .../tsxReactEmit4_es2015.2.minified.js | 4 +- .../tsxReactEmit4_es5.2.minified.js | 4 +- .../tsxReactEmit5_es2015.2.minified.js | 6 +- .../tsxReactEmit5_es5.2.minified.js | 6 +- .../tsxReactEmit6_es2015.2.minified.js | 4 +- .../tsxReactEmit6_es5.2.minified.js | 4 +- .../tsxReactEmit7_es2015.2.minified.js | 19 ---- .../tsxReactEmit7_es5.2.minified.js | 19 ---- .../tsxReactEmit8_es2015.2.minified.js | 3 - .../tsxReactEmit8_es5.2.minified.js | 3 - .../tsxReactEmitEntities_es2015.2.minified.js | 7 -- .../tsxReactEmitEntities_es5.2.minified.js | 7 -- ...xReactEmitWhitespace2_es2015.2.minified.js | 1 - .../tsxReactEmitWhitespace2_es5.2.minified.js | 1 - ...sxReactEmitWhitespace_es2015.2.minified.js | 1 - .../tsxReactEmitWhitespace_es5.2.minified.js | 1 - ...nNullStrictNullChecks_es2015.2.minified.js | 6 +- ...turnNullStrictNullChecks_es5.2.minified.js | 7 +- .../tsxSfcReturnNull_es2015.2.minified.js | 6 +- .../tsxSfcReturnNull_es5.2.minified.js | 7 +- ...finedStrictNullChecks_es2015.2.minified.js | 4 +- ...ndefinedStrictNullChecks_es5.2.minified.js | 3 +- ...ttributesResolution10_es2015.2.minified.js | 8 +- ...adAttributesResolution10_es5.2.minified.js | 8 +- ...ttributesResolution11_es2015.2.minified.js | 12 +- ...adAttributesResolution11_es5.2.minified.js | 12 +- ...ttributesResolution12_es2015.2.minified.js | 10 +- ...adAttributesResolution12_es5.2.minified.js | 10 +- ...ttributesResolution17_es2015.2.minified.js | 2 +- ...adAttributesResolution17_es5.2.minified.js | 2 +- ...AttributesResolution1_es2015.2.minified.js | 2 +- ...eadAttributesResolution1_es5.2.minified.js | 2 +- ...AttributesResolution2_es2015.2.minified.js | 11 +- ...eadAttributesResolution2_es5.2.minified.js | 11 +- ...AttributesResolution3_es2015.2.minified.js | 5 +- ...eadAttributesResolution3_es5.2.minified.js | 5 +- ...AttributesResolution4_es2015.2.minified.js | 12 +- ...eadAttributesResolution4_es5.2.minified.js | 12 +- ...AttributesResolution5_es2015.2.minified.js | 8 +- ...eadAttributesResolution5_es5.2.minified.js | 8 +- ...AttributesResolution6_es2015.2.minified.js | 3 - ...eadAttributesResolution6_es5.2.minified.js | 3 - ...AttributesResolution7_es2015.2.minified.js | 6 +- ...eadAttributesResolution7_es5.2.minified.js | 6 +- ...AttributesResolution8_es2015.2.minified.js | 6 +- ...eadAttributesResolution8_es5.2.minified.js | 6 +- ...AttributesResolution9_es2015.2.minified.js | 4 +- ...eadAttributesResolution9_es5.2.minified.js | 4 +- ...adChildrenInvalidType_es2015.2.minified.js | 4 +- ...preadChildrenInvalidType_es5.2.minified.js | 4 +- .../tsxSpreadChildren_es2015.2.minified.js | 4 +- .../tsxSpreadChildren_es5.2.minified.js | 4 +- ...ionComponentOverload1_es2015.2.minified.js | 48 +------- ...nctionComponentOverload1_es5.2.minified.js | 48 +------- ...ionComponentOverload2_es2015.2.minified.js | 16 ++- ...nctionComponentOverload2_es5.2.minified.js | 17 ++- ...ionComponentOverload3_es2015.2.minified.js | 16 +-- ...nctionComponentOverload3_es5.2.minified.js | 16 +-- ...ionComponentOverload4_es2015.2.minified.js | 39 ++----- ...nctionComponentOverload4_es5.2.minified.js | 40 ++----- ...ionComponentOverload5_es2015.2.minified.js | 21 ++-- ...nctionComponentOverload5_es5.2.minified.js | 22 ++-- ...ionComponentOverload6_es2015.2.minified.js | 30 ++--- ...nctionComponentOverload6_es5.2.minified.js | 29 ++--- ...DefaultTypeParameter1_es2015.2.minified.js | 10 +- ...ithDefaultTypeParameter1_es5.2.minified.js | 10 +- ...DefaultTypeParameter2_es2015.2.minified.js | 7 +- ...ithDefaultTypeParameter2_es5.2.minified.js | 7 +- ...ssFunctionComponents2_es2015.2.minified.js | 20 ---- ...elessFunctionComponents2_es5.2.minified.js | 33 +----- ...ssFunctionComponents3_es2015.2.minified.js | 5 +- ...elessFunctionComponents3_es5.2.minified.js | 5 +- ...ntsWithTypeArguments1_es2015.2.minified.js | 11 +- ...onentsWithTypeArguments1_es5.2.minified.js | 10 +- ...ntsWithTypeArguments2_es2015.2.minified.js | 11 +- ...onentsWithTypeArguments2_es5.2.minified.js | 10 +- .../tsxTypeErrors_es2015.2.minified.js | 21 ---- .../tsxTypeErrors_es5.2.minified.js | 19 ---- .../tsxUnionElementType1_es2015.2.minified.js | 7 +- .../tsxUnionElementType1_es5.2.minified.js | 7 +- .../tsxUnionElementType2_es2015.2.minified.js | 7 +- .../tsxUnionElementType2_es5.2.minified.js | 7 +- .../tsxUnionElementType3_es2015.2.minified.js | 8 -- .../tsxUnionElementType3_es5.2.minified.js | 9 +- .../tsxUnionElementType4_es2015.2.minified.js | 7 -- .../tsxUnionElementType4_es5.2.minified.js | 7 -- .../tsxUnionElementType5_es2015.2.minified.js | 12 +- .../tsxUnionElementType5_es5.2.minified.js | 11 +- .../tsxUnionElementType6_es2015.2.minified.js | 14 +-- .../tsxUnionElementType6_es5.2.minified.js | 13 +-- ...sxUnionTypeComponent1_es2015.2.minified.js | 6 - .../tsxUnionTypeComponent1_es5.2.minified.js | 11 +- ...sxUnionTypeComponent2_es2015.2.minified.js | 3 +- .../tsxUnionTypeComponent2_es5.2.minified.js | 2 +- .../uniqueSymbols_es5.2.minified.js | 13 +-- .../src/compress/optimize/mod.rs | 47 ++++++++ crates/swc_ecma_minifier/src/metadata/mod.rs | 17 +++ .../fixture/issues/quagga2/1.4.2/1/output.js | 10 +- .../d6e1aeb5-38a8d7ae57119c23/output.js | 4 +- .../pages/_app-72ad41192608e93a/output.js | 4 +- 312 files changed, 496 insertions(+), 2409 deletions(-) diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType_es2015.2.minified.js index b5b12353a4a..9a290a2727c 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType_es2015.2.minified.js @@ -1,4 +1,3 @@ import React from "react"; class ResizablePanel extends React.Component { } -React.createElement(ResizablePanel, null, React.createElement("div", null), React.createElement("div", null)), React.createElement(ResizablePanel, null, React.createElement("div", null), React.createElement("div", null), React.createElement("div", null)); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType_es5.2.minified.js index 60f173cc12c..c6621886ec9 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenCanBeTupleType_es5.2.minified.js @@ -9,4 +9,3 @@ var ResizablePanel = function(_Component) { } return ResizablePanel; }(React.Component); -React.createElement(ResizablePanel, null, React.createElement("div", null), React.createElement("div", null)), React.createElement(ResizablePanel, null, React.createElement("div", null), React.createElement("div", null), React.createElement("div", null)); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty10_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty10_es2015.2.minified.js index c2f74c0b7e2..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty10_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty10_es2015.2.minified.js @@ -1,6 +0,0 @@ -React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", React.createElement("h1", null, " world ")), React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", (user)=>React.createElement("h2", null, user.name) -), React.createElement("div", null, " ", 1, " ", "That is a number", " "), React.createElement(class { - render() { - return React.createElement("div", null, "My Button"); - } -}, null, " ", React.createElement("h2", null, " Hello "), " "); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty10_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty10_es5.2.minified.js index 2cd50765ce5..c7676999042 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty10_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty10_es5.2.minified.js @@ -8,6 +8,3 @@ var Button = function() { return React.createElement("div", null, "My Button"); }, Button; }(); -React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", React.createElement("h1", null, " world ")), React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", function(user) { - return React.createElement("h2", null, user.name); -}), React.createElement("div", null, " ", 1, " ", "That is a number", " "), React.createElement(Button, null, " ", React.createElement("h2", null, " Hello "), " "); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty11_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty11_es2015.2.minified.js index c2f74c0b7e2..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty11_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty11_es2015.2.minified.js @@ -1,6 +0,0 @@ -React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", React.createElement("h1", null, " world ")), React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", (user)=>React.createElement("h2", null, user.name) -), React.createElement("div", null, " ", 1, " ", "That is a number", " "), React.createElement(class { - render() { - return React.createElement("div", null, "My Button"); - } -}, null, " ", React.createElement("h2", null, " Hello "), " "); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty11_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty11_es5.2.minified.js index 2cd50765ce5..c7676999042 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty11_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty11_es5.2.minified.js @@ -8,6 +8,3 @@ var Button = function() { return React.createElement("div", null, "My Button"); }, Button; }(); -React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", React.createElement("h1", null, " world ")), React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", function(user) { - return React.createElement("h2", null, user.name); -}), React.createElement("div", null, " ", 1, " ", "That is a number", " "), React.createElement(Button, null, " ", React.createElement("h2", null, " Hello "), " "); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty14_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty14_es2015.2.minified.js index c78485f5148..a460a94d801 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty14_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty14_es2015.2.minified.js @@ -4,29 +4,5 @@ class Button extends React.Component { return React.createElement("div", null, "My Button"); } } -function AnotherButton(p) { - return React.createElement("h1", null, "Just Another Button"); -} -function Comp(p) { - return React.createElement("div", null, p.b); -} -function SingleChildComp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null), React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null, React.createElement(Button, null)), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null, React.createElement(Button, null), React.createElement(AnotherButton, null))), React.createElement(SingleChildComp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null, React.createElement(Button, null), React.createElement(AnotherButton, null))), React.createElement(SingleChildComp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null), React.createElement(Button, null), React.createElement(AnotherButton, null)); +React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment; export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty14_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty14_es5.2.minified.js index 93b88e39d61..399518a9a35 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty14_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty14_es5.2.minified.js @@ -10,28 +10,4 @@ var React = require("react"), Button = function(_Component) { return React.createElement("div", null, "My Button"); }, Button; }(React.Component); -function AnotherButton(p) { - return React.createElement("h1", null, "Just Another Button"); -} -function Comp(p) { - return React.createElement("div", null, p.b); -} -function SingleChildComp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null), React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null, React.createElement(Button, null)), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null, React.createElement(Button, null), React.createElement(AnotherButton, null))), React.createElement(SingleChildComp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null, React.createElement(Button, null), React.createElement(AnotherButton, null))), React.createElement(SingleChildComp, { - a: 10, - b: "hi" -}, React.createElement(React.Fragment, null), React.createElement(Button, null), React.createElement(AnotherButton, null)); +React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty15_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty15_es2015.2.minified.js index 4e608a5bede..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty15_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty15_es2015.2.minified.js @@ -1,10 +1,2 @@ -const React = require("react"), Tag = (x)=>React.createElement("div", null) -; -React.createElement(Tag, null), React.createElement(Tag, null), React.createElement(Tag, { - children: React.createElement("div", null) -}), React.createElement(Tag, { - key: "1" -}, React.createElement("div", null)), React.createElement(Tag, { - key: "1" -}, React.createElement("div", null), React.createElement("div", null)); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty15_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty15_es5.2.minified.js index 4935e7ac5a8..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty15_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty15_es5.2.minified.js @@ -1,11 +1,2 @@ -var React = require("react"), Tag = function(x) { - return React.createElement("div", null); -}; -React.createElement(Tag, null), React.createElement(Tag, null), React.createElement(Tag, { - children: React.createElement("div", null) -}), React.createElement(Tag, { - key: "1" -}, React.createElement("div", null)), React.createElement(Tag, { - key: "1" -}, React.createElement("div", null), React.createElement("div", null)); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty1_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty1_es2015.2.minified.js index 726727fca21..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty1_es2015.2.minified.js @@ -1,16 +1,2 @@ -const React = require("react"); -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi", - children: "lol" -}), React.createElement(Comp, { - a: 10, - b: "hi" -}, "hi hi hi!"), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, "hi hi hi!")); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty1_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty1_es5.2.minified.js index 1ab5a5c1e6f..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty1_es5.2.minified.js @@ -1,16 +1,2 @@ -var React = require("react"); -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi", - children: "lol" -}), React.createElement(Comp, { - a: 10, - b: "hi" -}, "hi hi hi!"), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, "hi hi hi!")); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty2_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty2_es2015.2.minified.js index 119ba782b45..83bfe4fb850 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty2_es2015.2.minified.js @@ -1,31 +1,9 @@ import * as swcHelpers from "@swc/helpers"; const React = require("react"); -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}), React.createElement(Comp, { - a: 10, - b: "hi", - children: "Random" -}, "hi hi hi!"), React.createElement(Comp, swcHelpers.extends({ +swcHelpers.extends({ a: 10, b: "hi" }, { children: "Random" -}), "hi hi hi!"), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, " My Div "), (name)=>React.createElement("div", null, " My name ", name, " ") -), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, " My Div "), 1000000), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, " My Div "), "hi hi hi!"), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, " My Div "), React.createElement("div", null, " My Div ")); +}), (name)=>React.createElement("div", null, " My name ", name, " ") +; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty2_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty2_es5.2.minified.js index 49a15d81ee0..279a6aa33d7 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty2_es5.2.minified.js @@ -1,32 +1,7 @@ import * as swcHelpers from "@swc/helpers"; -var React = require("react"); -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}), React.createElement(Comp, { - a: 10, - b: "hi", - children: "Random" -}, "hi hi hi!"), React.createElement(Comp, swcHelpers.extends({ +require("react"), swcHelpers.extends({ a: 10, b: "hi" }, { children: "Random" -}), "hi hi hi!"), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, " My Div "), function(name) { - return React.createElement("div", null, " My name ", name, " "); -}), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, " My Div "), 1000000), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, " My Div "), "hi hi hi!"), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement("div", null, " My Div "), React.createElement("div", null, " My Div ")); +}); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty5_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty5_es2015.2.minified.js index 9e62e23e022..5c693a08665 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty5_es2015.2.minified.js @@ -4,17 +4,4 @@ class Button extends React.Component { return React.createElement("div", null, "My Button"); } } -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, Button); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty5_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty5_es5.2.minified.js index ed55fe3b4f0..1204b6f88ae 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty5_es5.2.minified.js @@ -10,16 +10,3 @@ var React = require("react"), Button = function(_Component) { return React.createElement("div", null, "My Button"); }, Button; }(React.Component); -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, Button); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty6_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty6_es2015.2.minified.js index 6fb6e7a9f4d..5c693a08665 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty6_es2015.2.minified.js @@ -4,23 +4,4 @@ class Button extends React.Component { return React.createElement("div", null, "My Button"); } } -function AnotherButton(p) { - return React.createElement("h1", null, "Just Another Button"); -} -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null)); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty6_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty6_es5.2.minified.js index 3345dad6acf..1204b6f88ae 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty6_es5.2.minified.js @@ -10,22 +10,3 @@ var React = require("react"), Button = function(_Component) { return React.createElement("div", null, "My Button"); }, Button; }(React.Component); -function AnotherButton(p) { - return React.createElement("h1", null, "Just Another Button"); -} -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null)); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty7_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty7_es2015.2.minified.js index fd2fb429722..5c693a08665 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty7_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty7_es2015.2.minified.js @@ -4,20 +4,4 @@ class Button extends React.Component { return React.createElement("div", null, "My Button"); } } -function AnotherButton(p) { - return React.createElement("h1", null, "Just Another Button"); -} -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), " ", React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null), " "), React.createElement(Comp, { - a: 10, - b: "hi" -}, " ", React.createElement(Button, null), React.createElement(AnotherButton, null)); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty7_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty7_es5.2.minified.js index c78c75c745e..1204b6f88ae 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty7_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty7_es5.2.minified.js @@ -10,19 +10,3 @@ var React = require("react"), Button = function(_Component) { return React.createElement("div", null, "My Button"); }, Button; }(React.Component); -function AnotherButton(p) { - return React.createElement("h1", null, "Just Another Button"); -} -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), " ", React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null), " "), React.createElement(Comp, { - a: 10, - b: "hi" -}, " ", React.createElement(Button, null), React.createElement(AnotherButton, null)); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty8_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty8_es2015.2.minified.js index 9c61eb455e9..5c693a08665 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty8_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty8_es2015.2.minified.js @@ -4,23 +4,4 @@ class Button extends React.Component { return React.createElement("div", null, "My Button"); } } -function AnotherButton(p) { - return React.createElement("h1", null, "Just Another Button"); -} -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), " ", React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null), " "), React.createElement(Comp, { - a: 10, - b: "hi" -}, " ", React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), " "); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty8_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty8_es5.2.minified.js index 07a4fc660b0..1204b6f88ae 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty8_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty8_es5.2.minified.js @@ -10,22 +10,3 @@ var React = require("react"), Button = function(_Component) { return React.createElement("div", null, "My Button"); }, Button; }(React.Component); -function AnotherButton(p) { - return React.createElement("h1", null, "Just Another Button"); -} -function Comp(p) { - return React.createElement("div", null, p.b); -} -React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), " ", React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), React.createElement(AnotherButton, null), " "), React.createElement(Comp, { - a: 10, - b: "hi" -}, " ", React.createElement(Button, null), React.createElement(AnotherButton, null)), React.createElement(Comp, { - a: 10, - b: "hi" -}, React.createElement(Button, null), " "); diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty9_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty9_es2015.2.minified.js index 538ccef9146..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty9_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty9_es2015.2.minified.js @@ -1,4 +1,2 @@ -const React = require("react"); -React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", React.createElement("h1", null, " world ")), React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", (user)=>React.createElement("h2", null, user.name) -), React.createElement("div", null, " ", 1, " ", "That is a number", " "); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxChildrenProperty9_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxChildrenProperty9_es5.2.minified.js index ff5793dc689..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/checkJsxChildrenProperty9_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxChildrenProperty9_es5.2.minified.js @@ -1,5 +1,2 @@ -var React = require("react"); -React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", React.createElement("h1", null, " world ")), React.createElement("div", null, " ", React.createElement("h2", null, " Hello "), " ", function(user) { - return React.createElement("h2", null, user.name); -}), React.createElement("div", null, " ", 1, " ", "That is a number", " "); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences_es2015.2.minified.js index 625c25f9b41..4b7c4cb5fbd 100644 --- a/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences_es2015.2.minified.js @@ -1,22 +1 @@ import * as React from "react"; -React.createElement(GenericComponent, { - initialValues: { - x: "y" - }, - nextValues: (a)=>a -}), React.createElement(GenericComponent, { - initialValues: 12, - nextValues: (a)=>a -}), React.createElement(GenericComponent, { - initialValues: { - x: "y" - }, - nextValues: (a)=>({ - x: a.x - }) -}), React.createElement(GenericComponent, { - initialValues: { - x: "y" - }, - nextValues: (a)=>a.x -}); diff --git a/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences_es5.2.minified.js index 41fd04bae12..4b7c4cb5fbd 100644 --- a/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxGenericTagHasCorrectInferences_es5.2.minified.js @@ -1,30 +1 @@ import * as React from "react"; -React.createElement(GenericComponent, { - initialValues: { - x: "y" - }, - nextValues: function(a) { - return a; - } -}), React.createElement(GenericComponent, { - initialValues: 12, - nextValues: function(a) { - return a; - } -}), React.createElement(GenericComponent, { - initialValues: { - x: "y" - }, - nextValues: function(a) { - return { - x: a.x - }; - } -}), React.createElement(GenericComponent, { - initialValues: { - x: "y" - }, - nextValues: function(a) { - return a.x; - } -}); diff --git a/crates/swc/tests/tsc-references/checkJsxIntersectionElementPropsType_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxIntersectionElementPropsType_es2015.2.minified.js index 2337564812b..761a5a61d9f 100644 --- a/crates/swc/tests/tsc-references/checkJsxIntersectionElementPropsType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxIntersectionElementPropsType_es2015.2.minified.js @@ -1,7 +1,4 @@ -class C extends Component { -} -new C({ - foobar: "example" -}), React.createElement(C, { +new class extends Component { +}({ foobar: "example" }); diff --git a/crates/swc/tests/tsc-references/checkJsxIntersectionElementPropsType_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxIntersectionElementPropsType_es5.2.minified.js index ca2d06f1048..ced51ad9cf0 100644 --- a/crates/swc/tests/tsc-references/checkJsxIntersectionElementPropsType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxIntersectionElementPropsType_es5.2.minified.js @@ -10,6 +10,4 @@ var C = function(Component) { }(Component); new C({ foobar: "example" -}), React.createElement(C, { - foobar: "example" }); diff --git a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug_es2015.2.minified.js b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug_es2015.2.minified.js index 5c1e5e81347..2aeda18e9de 100644 --- a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug_es2015.2.minified.js @@ -5,16 +5,3 @@ class AsyncLoader extends React.Component { return null; } } -function _load() { - return (_load = swcHelpers.asyncToGenerator(function*() { - return { - success: !0 - }; - })).apply(this, arguments); -} -React.createElement(AsyncLoader, { - prop1: function() { - return _load.apply(this, arguments); - }, - prop2: (result)=>result -}); diff --git a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug_es5.2.minified.js b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug_es5.2.minified.js index 2099d6ff673..45802efe9fd 100644 --- a/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/checkJsxSubtleSkipContextSensitiveBug_es5.2.minified.js @@ -12,26 +12,3 @@ var AsyncLoader = function(_Component) { return null; }, AsyncLoader; }(React.Component); -function _load() { - return (_load = swcHelpers.asyncToGenerator(regeneratorRuntime.mark(function _callee() { - return regeneratorRuntime.wrap(function(_ctx) { - for(;;)switch(_ctx.prev = _ctx.next){ - case 0: - return _ctx.abrupt("return", { - success: !0 - }); - case 1: - case "end": - return _ctx.stop(); - } - }, _callee); - }))).apply(this, arguments); -} -React.createElement(AsyncLoader, { - prop1: function() { - return _load.apply(this, arguments); - }, - prop2: function(result) { - return result; - } -}); diff --git a/crates/swc/tests/tsc-references/classExpression2_es5.2.minified.js b/crates/swc/tests/tsc-references/classExpression2_es5.2.minified.js index 2981f28ae30..cc2640cbd2c 100644 --- a/crates/swc/tests/tsc-references/classExpression2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classExpression2_es5.2.minified.js @@ -3,11 +3,3 @@ var D = function() { "use strict"; swcHelpers.classCallCheck(this, D); }; -!function(D1) { - "use strict"; - swcHelpers.inherits(C, D1); - var _super = swcHelpers.createSuper(C); - function C() { - return swcHelpers.classCallCheck(this, C), _super.apply(this, arguments); - } -}(D); diff --git a/crates/swc/tests/tsc-references/classExpressionES62_es5.2.minified.js b/crates/swc/tests/tsc-references/classExpressionES62_es5.2.minified.js index 2981f28ae30..cc2640cbd2c 100644 --- a/crates/swc/tests/tsc-references/classExpressionES62_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/classExpressionES62_es5.2.minified.js @@ -3,11 +3,3 @@ var D = function() { "use strict"; swcHelpers.classCallCheck(this, D); }; -!function(D1) { - "use strict"; - swcHelpers.inherits(C, D1); - var _super = swcHelpers.createSuper(C); - function C() { - return swcHelpers.classCallCheck(this, C), _super.apply(this, arguments); - } -}(D); diff --git a/crates/swc/tests/tsc-references/commentEmittingInPreserveJsx1_es2015.2.minified.js b/crates/swc/tests/tsc-references/commentEmittingInPreserveJsx1_es2015.2.minified.js index 87d680138c4..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/commentEmittingInPreserveJsx1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/commentEmittingInPreserveJsx1_es2015.2.minified.js @@ -1,3 +1,2 @@ -const React = require("react"); -React.createElement("div", null, "// Not Comment"), React.createElement("div", null, "// Not Comment", "// Another not Comment"), React.createElement("div", null, "// Not Comment", "Hi", "// Another not Comment"), React.createElement("div", null, "/* Not Comment */", "Hi"); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/commentEmittingInPreserveJsx1_es5.2.minified.js b/crates/swc/tests/tsc-references/commentEmittingInPreserveJsx1_es5.2.minified.js index 1412470f9ec..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/commentEmittingInPreserveJsx1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/commentEmittingInPreserveJsx1_es5.2.minified.js @@ -1,3 +1,2 @@ -var React = require("react"); -React.createElement("div", null, "// Not Comment"), React.createElement("div", null, "// Not Comment", "// Another not Comment"), React.createElement("div", null, "// Not Comment", "Hi", "// Another not Comment"), React.createElement("div", null, "/* Not Comment */", "Hi"); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes01_es2015.2.minified.js b/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes01_es2015.2.minified.js index cdb84f7672a..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes01_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes01_es2015.2.minified.js @@ -1,11 +0,0 @@ -const FooComponent = (props)=>React.createElement("span", null, props.foo) -; -React.createElement(FooComponent, { - foo: "A" -}), React.createElement(FooComponent, { - foo: "A" -}), React.createElement(FooComponent, { - foo: "f" -}), React.createElement(FooComponent, { - foo: "f" -}); diff --git a/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes01_es5.2.minified.js b/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes01_es5.2.minified.js index 32adad9b12c..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes01_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes01_es5.2.minified.js @@ -1,12 +0,0 @@ -var FooComponent = function(props) { - return React.createElement("span", null, props.foo); -}; -React.createElement(FooComponent, { - foo: "A" -}), React.createElement(FooComponent, { - foo: "A" -}), React.createElement(FooComponent, { - foo: "f" -}), React.createElement(FooComponent, { - foo: "f" -}); diff --git a/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes02_es2015.2.minified.js b/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes02_es2015.2.minified.js index e1aed59d0bd..a1ae17e822f 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes02_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes02_es2015.2.minified.js @@ -1,38 +1,30 @@ import * as swcHelpers from "@swc/helpers"; -const React = require("react"); +require("react"); export function MainButton(props) { return props.goTo ? this._buildMainLink(props) : this._buildMainButton(props); } -React.createElement(MainButton, swcHelpers.extends({}, { +swcHelpers.extends({}, { onClick: (k)=>{ console.log(k); } }, { extra: !0 -})), React.createElement(MainButton, { - onClick: (k)=>{ - console.log(k); - }, - extra: !0 -}), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { goTo: "home" }, { extra: !0 -})), React.createElement(MainButton, { - goTo: "home", - extra: !0 }); export function NoOverload() {} -React.createElement(NoOverload, swcHelpers.extends({}, { +swcHelpers.extends({}, { onClick: (k)=>{ console.log(k); } }, { extra: !0 -})); +}); export function NoOverload1() {} -React.createElement(NoOverload1, swcHelpers.extends({}, { +swcHelpers.extends({}, { goTo: "home" }, { extra: !0 -})); +}); diff --git a/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes02_es5.2.minified.js b/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes02_es5.2.minified.js index 26d641fcf4d..716f12e1199 100644 --- a/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes02_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/contextuallyTypedStringLiteralsInJsxAttributes02_es5.2.minified.js @@ -1,38 +1,30 @@ import * as swcHelpers from "@swc/helpers"; -var React = require("react"); +require("react"); export function MainButton(props) { return props.goTo ? this._buildMainLink(props) : this._buildMainButton(props); } -React.createElement(MainButton, swcHelpers.extends({}, { +swcHelpers.extends({}, { onClick: function(k) { console.log(k); } }, { extra: !0 -})), React.createElement(MainButton, { - onClick: function(k) { - console.log(k); - }, - extra: !0 -}), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { goTo: "home" }, { extra: !0 -})), React.createElement(MainButton, { - goTo: "home", - extra: !0 }); export function NoOverload() {} -React.createElement(NoOverload, swcHelpers.extends({}, { +swcHelpers.extends({}, { onClick: function(k) { console.log(k); } }, { extra: !0 -})); +}); export function NoOverload1() {} -React.createElement(NoOverload1, swcHelpers.extends({}, { +swcHelpers.extends({}, { goTo: "home" }, { extra: !0 -})); +}); diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es2015.2.minified.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es2015.2.minified.js index 744e5c901ea..74eb1580d2b 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es2015.2.minified.js @@ -2,8 +2,6 @@ import * as swcHelpers from "@swc/helpers"; import * as cx from "classnames"; import * as React from "react"; let buttonProps; -React.createElement("button", swcHelpers.extends({}, buttonProps), React.createElement("span", { - className: cx("class1", { - class2: !0 - }) -})); +swcHelpers.extends({}, buttonProps), cx("class1", { + class2: !0 +}); diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es5.2.minified.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es5.2.minified.js index 73212fcc29c..9473268395a 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences1_es5.2.minified.js @@ -2,8 +2,6 @@ var buttonProps; import * as swcHelpers from "@swc/helpers"; import * as cx from "classnames"; import * as React from "react"; -React.createElement("button", swcHelpers.extends({}, buttonProps), React.createElement("span", { - className: cx("class1", { - class2: !0 - }) -})); +swcHelpers.extends({}, buttonProps), cx("class1", { + class2: !0 +}); diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es2015.2.minified.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es2015.2.minified.js index 744e5c901ea..74eb1580d2b 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es2015.2.minified.js @@ -2,8 +2,6 @@ import * as swcHelpers from "@swc/helpers"; import * as cx from "classnames"; import * as React from "react"; let buttonProps; -React.createElement("button", swcHelpers.extends({}, buttonProps), React.createElement("span", { - className: cx("class1", { - class2: !0 - }) -})); +swcHelpers.extends({}, buttonProps), cx("class1", { + class2: !0 +}); diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es5.2.minified.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es5.2.minified.js index 73212fcc29c..9473268395a 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences2_es5.2.minified.js @@ -2,8 +2,6 @@ var buttonProps; import * as swcHelpers from "@swc/helpers"; import * as cx from "classnames"; import * as React from "react"; -React.createElement("button", swcHelpers.extends({}, buttonProps), React.createElement("span", { - className: cx("class1", { - class2: !0 - }) -})); +swcHelpers.extends({}, buttonProps), cx("class1", { + class2: !0 +}); diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es2015.2.minified.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es2015.2.minified.js index 744e5c901ea..74eb1580d2b 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es2015.2.minified.js @@ -2,8 +2,6 @@ import * as swcHelpers from "@swc/helpers"; import * as cx from "classnames"; import * as React from "react"; let buttonProps; -React.createElement("button", swcHelpers.extends({}, buttonProps), React.createElement("span", { - className: cx("class1", { - class2: !0 - }) -})); +swcHelpers.extends({}, buttonProps), cx("class1", { + class2: !0 +}); diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es5.2.minified.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es5.2.minified.js index 73212fcc29c..9473268395a 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences3_es5.2.minified.js @@ -2,8 +2,6 @@ var buttonProps; import * as swcHelpers from "@swc/helpers"; import * as cx from "classnames"; import * as React from "react"; -React.createElement("button", swcHelpers.extends({}, buttonProps), React.createElement("span", { - className: cx("class1", { - class2: !0 - }) -})); +swcHelpers.extends({}, buttonProps), cx("class1", { + class2: !0 +}); diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es2015.2.minified.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es2015.2.minified.js index 10cb643b8c1..61e46c7599e 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es2015.2.minified.js @@ -2,8 +2,8 @@ import * as swcHelpers from "@swc/helpers"; import * as cx from "classnames"; import * as React from "react"; let buttonProps; -React.createElement("button", swcHelpers.extends({}, buttonProps, { +swcHelpers.extends({}, buttonProps, { className: cx("class1", { class2: !0 }) -})); +}); diff --git a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es5.2.minified.js b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es5.2.minified.js index 599e32f5d54..4541edc3968 100644 --- a/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/correctlyMarkAliasAsReferences4_es5.2.minified.js @@ -2,8 +2,8 @@ var buttonProps; import * as swcHelpers from "@swc/helpers"; import * as cx from "classnames"; import * as React from "react"; -React.createElement("button", swcHelpers.extends({}, buttonProps, { +swcHelpers.extends({}, buttonProps, { className: cx("class1", { class2: !0 }) -})); +}); diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.2.minified.js index 0c489fd2bea..3d67ad68af7 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es2015.2.minified.js @@ -1,4 +1,3 @@ import { h, Frag } from "./preact"; import { h } from "./snabbdom"; import { h } from "./preact"; -h(Frag, null, h("span", null)), h(Frag, null, h("div", null)), h(Frag, null, h("div", null)), h(Frag, null, h("span", null)); diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.2.minified.js index 0c489fd2bea..3d67ad68af7 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragmaOverridesCompilerOptions_es5.2.minified.js @@ -1,4 +1,3 @@ import { h, Frag } from "./preact"; import { h } from "./snabbdom"; import { h } from "./preact"; -h(Frag, null, h("span", null)), h(Frag, null, h("div", null)), h(Frag, null, h("div", null)), h(Frag, null, h("span", null)); diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.2.minified.js index 29fa8565bfc..2715214423d 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es2015.2.minified.js @@ -4,6 +4,3 @@ import { Fragment } from "./renderer"; import "./renderer"; import { h, Fragment } from "./renderer"; import { h } from "./renderer"; -h(Fragment, null, h("div", null)), h(Fragment, null, h("span", null)), h(Fragment, null), h(Fragment, null), h(Fragment, null), h(Fragment, null), h("div", null), h("div", null), h(function() { - return null; -}, null); diff --git a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.2.minified.js index 29fa8565bfc..2715214423d 100644 --- a/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxAndJsxFragPragma_es5.2.minified.js @@ -4,6 +4,3 @@ import { Fragment } from "./renderer"; import "./renderer"; import { h, Fragment } from "./renderer"; import { h } from "./renderer"; -h(Fragment, null, h("div", null)), h(Fragment, null, h("span", null)), h(Fragment, null), h(Fragment, null), h(Fragment, null), h(Fragment, null), h("div", null), h("div", null), h(function() { - return null; -}, null); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.2.minified.js index b0f70705c1f..2b53e033879 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es2015.2.minified.js @@ -21,36 +21,3 @@ export const tree = predom(MySFC, { y: 6 })); export default predom("h", null); -predom("h", null); -const DOMSFC = (props)=>predom("p", null, props.x, " + ", props.y, " = ", props.x + props.y, props.children) -; -class DOMClass { - render() { - return predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); - } - constructor(props){ - this.props = props; - } -} -predom(DOMSFC, { - x: 1, - y: 2 -}, predom(DOMClass, { - x: 3, - y: 4 -}), predom(DOMClass, { - x: 5, - y: 6 -})), predom(MySFC, { - x: 1, - y: 2 -}, predom(MyClass, { - x: 3, - y: 4 -}), predom(MyClass, { - x: 5, - y: 6 -})), predom(DOMSFC, { - x: 1, - y: 2 -}, tree, tree); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.2.minified.js index 6db645f08cd..35a0261e49b 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryDeclarationsLocalTypes_es5.2.minified.js @@ -24,10 +24,7 @@ export var tree = predom(MySFC, { y: 6 })); export default predom("h", null); -predom("h", null); -var DOMSFC = function(props) { - return predom("p", null, props.x, " + ", props.y, " = ", props.x + props.y, props.children); -}, DOMClass = function() { +var DOMClass = function() { "use strict"; function DOMClass(props) { swcHelpers.classCallCheck(this, DOMClass), this.props = props; @@ -36,25 +33,3 @@ var DOMSFC = function(props) { return predom("p", null, this.props.x, " + ", this.props.y, " = ", this.props.x + this.props.y); }, DOMClass; }(); -predom(DOMSFC, { - x: 1, - y: 2 -}, predom(DOMClass, { - x: 3, - y: 4 -}), predom(DOMClass, { - x: 5, - y: 6 -})), predom(MySFC, { - x: 1, - y: 2 -}, predom(MyClass, { - x: 3, - y: 4 -}), predom(MyClass, { - x: 5, - y: 6 -})), predom(DOMSFC, { - x: 1, - y: 2 -}, tree, tree); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.2.minified.js index 0eb84e19319..be64f0c278b 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es2015.2.minified.js @@ -1,4 +1,3 @@ import { predom } from "./renderer2"; import prerendered from "./component"; export default predom("h", null); -predom("h", null); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.2.minified.js index 0eb84e19319..be64f0c278b 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryLocalTypeGlobalFallback_es5.2.minified.js @@ -1,4 +1,3 @@ import { predom } from "./renderer2"; import prerendered from "./component"; export default predom("h", null); -predom("h", null); diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.2.minified.js index 8cc8e9f03d4..21a94df3c1d 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es2015.2.minified.js @@ -1,4 +1,3 @@ import { dom } from "./renderer"; import { p } from "./renderer"; -dom("h", null), dom("h", null); export { dom as p }; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.2.minified.js index 8cc8e9f03d4..21a94df3c1d 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryOverridesCompilerOption_es5.2.minified.js @@ -1,4 +1,3 @@ import { dom } from "./renderer"; import { p } from "./renderer"; -dom("h", null), dom("h", null); export { dom as p }; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.2.minified.js index f9827046183..82ae9ee69dd 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es2015.2.minified.js @@ -1,2 +1,2 @@ import * as React from "./renderer"; -React.createElement(React.Fragment, null, React.createElement("h", null)), React.createElement(React.Fragment, null, React.createElement("h", null)); +React.Fragment, React.Fragment; diff --git a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.2.minified.js b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.2.minified.js index f9827046183..82ae9ee69dd 100644 --- a/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/inlineJsxFactoryWithFragmentIsError_es5.2.minified.js @@ -1,2 +1,2 @@ import * as React from "./renderer"; -React.createElement(React.Fragment, null, React.createElement("h", null)), React.createElement(React.Fragment, null, React.createElement("h", null)); +React.Fragment, React.Fragment; diff --git a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.2.minified.js index 4ee3f4d21b3..c47dbaf8986 100644 --- a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es2015.2.minified.js @@ -1,6 +1,3 @@ import * as React from "react"; import * as React from "react"; -React.createElement(MyComp, { - a: 10, - b: "hi" -}); +MyComp; diff --git a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.2.minified.js index 4ee3f4d21b3..c47dbaf8986 100644 --- a/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxCheckJsxNoTypeArgumentsAllowed_es5.2.minified.js @@ -1,6 +1,3 @@ import * as React from "react"; import * as React from "react"; -React.createElement(MyComp, { - a: 10, - b: "hi" -}); +MyComp; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren_es2015.2.minified.js index 5d17d5e120c..fde2ecd4f19 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren_es2015.2.minified.js @@ -1,2 +1,2 @@ -React.createElement("div", null, "text"); +"text"; export { }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren_es5.2.minified.js index 5d17d5e120c..fde2ecd4f19 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformChildren_es5.2.minified.js @@ -1,2 +1,2 @@ -React.createElement("div", null, "text"); +"text"; export { }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.2.minified.js index 86b835e2368..9b9967d9bd9 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es2015.2.minified.js @@ -1,19 +1,2 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime"; import "./preact"; -_jsxs(_Fragment, { - children: [ - _jsx("p", {}), - "text", - _jsx("div", { - className: "foo" - }) - ] -}), _jsxs(_Fragment, { - children: [ - _jsx("p", {}), - "text", - _jsx("div", { - className: "foo" - }) - ] -}); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.2.minified.js index 86b835e2368..9b9967d9bd9 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImportPragma_es5.2.minified.js @@ -1,19 +1,2 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "preact/jsx-runtime"; import "./preact"; -_jsxs(_Fragment, { - children: [ - _jsx("p", {}), - "text", - _jsx("div", { - className: "foo" - }) - ] -}), _jsxs(_Fragment, { - children: [ - _jsx("p", {}), - "text", - _jsx("div", { - className: "foo" - }) - ] -}); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport_es2015.2.minified.js index 2b8d121b4ec..f405008a06c 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport_es2015.2.minified.js @@ -1,4 +1,2 @@ -React.createElement(React.Fragment, null, React.createElement("p", null), "text", React.createElement("div", { - className: "foo" -})); +React.Fragment; export { }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport_es5.2.minified.js index 2b8d121b4ec..f405008a06c 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformCustomImport_es5.2.minified.js @@ -1,4 +1,2 @@ -React.createElement(React.Fragment, null, React.createElement("p", null), "text", React.createElement("div", { - className: "foo" -})); +React.Fragment; export { }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.2.minified.js index 2fcfa873efa..1a690ed7aa0 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es2015.2.minified.js @@ -5,18 +5,18 @@ import "./preact"; const props = { answer: 42 }; -_jsx("div", swcHelpers.objectSpread({}, props, { +swcHelpers.objectSpread({}, props, { children: "text" -}), "foo"), _createElement("div", swcHelpers.objectSpread({}, props, { +}), swcHelpers.objectSpread({}, props, { key: "bar", children: "text" -})); +}); const props2 = { answer: 42 }; -_jsx("div", swcHelpers.objectSpread({}, props2, { +swcHelpers.objectSpread({}, props2, { children: "text" -}), "foo"), _createElement("div", swcHelpers.objectSpread({}, props2, { +}), swcHelpers.objectSpread({}, props2, { key: "bar", children: "text" -})); +}); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.2.minified.js index 6b5c4a088e6..a9bc2e0a00e 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImportPragma_es5.2.minified.js @@ -5,18 +5,18 @@ import "./preact"; var props = { answer: 42 }; -_jsx("div", swcHelpers.objectSpread({}, props, { +swcHelpers.objectSpread({}, props, { children: "text" -}), "foo"), _createElement("div", swcHelpers.objectSpread({}, props, { +}), swcHelpers.objectSpread({}, props, { key: "bar", children: "text" -})); +}); var props2 = { answer: 42 }; -_jsx("div", swcHelpers.objectSpread({}, props2, { +swcHelpers.objectSpread({}, props2, { children: "text" -}), "foo"), _createElement("div", swcHelpers.objectSpread({}, props2, { +}), swcHelpers.objectSpread({}, props2, { key: "bar", children: "text" -})); +}); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport_es2015.2.minified.js index 8e3ae701a3a..68c08582c94 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport_es2015.2.minified.js @@ -2,8 +2,8 @@ import * as swcHelpers from "@swc/helpers"; const props = { answer: 42 }; -React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({ key: "foo" -}, props), "text"), React.createElement("div", swcHelpers.extends({}, props, { +}, props), swcHelpers.extends({}, props, { key: "bar" -}), "text"); +}); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport_es5.2.minified.js index 468114a8140..ffaace561d8 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyPropCustomImport_es5.2.minified.js @@ -2,8 +2,8 @@ import * as swcHelpers from "@swc/helpers"; var props = { answer: 42 }; -React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({ key: "foo" -}, props), "text"), React.createElement("div", swcHelpers.extends({}, props, { +}, props), swcHelpers.extends({}, props, { key: "bar" -}), "text"); +}); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp_es2015.2.minified.js index 8e3ae701a3a..68c08582c94 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp_es2015.2.minified.js @@ -2,8 +2,8 @@ import * as swcHelpers from "@swc/helpers"; const props = { answer: 42 }; -React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({ key: "foo" -}, props), "text"), React.createElement("div", swcHelpers.extends({}, props, { +}, props), swcHelpers.extends({}, props, { key: "bar" -}), "text"); +}); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp_es5.2.minified.js index 468114a8140..ffaace561d8 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformKeyProp_es5.2.minified.js @@ -2,8 +2,8 @@ import * as swcHelpers from "@swc/helpers"; var props = { answer: 42 }; -React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({ key: "foo" -}, props), "text"), React.createElement("div", swcHelpers.extends({}, props, { +}, props), swcHelpers.extends({}, props, { key: "bar" -}), "text"); +}); diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment_es2015.2.minified.js index 276ca0127dd..f405008a06c 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment_es2015.2.minified.js @@ -1,2 +1,2 @@ -React.createElement(React.Fragment, null, React.createElement("p", null), "text", React.createElement("div", null)); +React.Fragment; export { }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment_es5.2.minified.js index 276ca0127dd..f405008a06c 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNamesFragment_es5.2.minified.js @@ -1,2 +1,2 @@ -React.createElement(React.Fragment, null, React.createElement("p", null), "text", React.createElement("div", null)); +React.Fragment; export { }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames_es2015.2.minified.js index e9839eec54b..2234b9cae16 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames_es2015.2.minified.js @@ -1,2 +1 @@ -React.createElement("div", null); export { }; diff --git a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames_es5.2.minified.js index e9839eec54b..2234b9cae16 100644 --- a/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxJsxsCjsTransformSubstitutesNames_es5.2.minified.js @@ -1,2 +1 @@ -React.createElement("div", null); export { }; diff --git a/crates/swc/tests/tsc-references/jsxParsingError4_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxParsingError4_es2015.2.minified.js index eda2bc834d4..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/jsxParsingError4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxParsingError4_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("public-foo", null), React.createElement("public", null); diff --git a/crates/swc/tests/tsc-references/jsxParsingError4_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxParsingError4_es5.2.minified.js index eda2bc834d4..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/jsxParsingError4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxParsingError4_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("public-foo", null), React.createElement("public", null); diff --git a/crates/swc/tests/tsc-references/jsxReactTestSuite_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxReactTestSuite_es2015.2.minified.js index 98abaf293e7..b19fcdeb062 100644 --- a/crates/swc/tests/tsc-references/jsxReactTestSuite_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxReactTestSuite_es2015.2.minified.js @@ -1,38 +1,30 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("div", null, "text"), React.createElement("div", null, this.props.children), React.createElement("div", null, React.createElement("div", null, React.createElement("br", null)), React.createElement(Component, null, foo, React.createElement("br", null), bar), React.createElement("br", null)), React.createElement(Composite, null, this.props.children), React.createElement(Composite, null, React.createElement(Composite2, null)); +this.props.children, Component, foo, bar, Composite, this.props.children, Composite, Composite2; var x = React.createElement("div", { attr1: "foobar", attr2: "foobarbazbug", attr3: "foobarbazbug", attr4: "baz" }); -React.createElement("div", null, React.createElement("span", null), React.createElement("br", null)), React.createElement("div", { - attr1: "foo" -}, React.createElement("span", { - attr2: "bar" -})), React.createElement("div", null, "\xa0"), React.createElement("div", null, "\xa0 "), React.createElement("hasOwnProperty", null, "testing"), React.createElement(Component, { - constructor: "foo" -}), React.createElement(Namespace.Component, null), React.createElement(Namespace.DeepNamespace.Component, null), React.createElement(Component, swcHelpers.extends({}, x, { +Namespace.Component, Namespace.DeepNamespace.Component, Component, swcHelpers.extends({}, x, { y: 2, z: !0 -})), React.createElement(Component, swcHelpers.extends({}, this.props, { +}), Component, swcHelpers.extends({}, this.props, { sound: "moo" -})), React.createElement("font-face", null), React.createElement(Component, { - x: y -}), React.createElement("x-component", null), React.createElement(Component, swcHelpers.extends({}, x)), React.createElement(Component, swcHelpers.extends({}, x, { +}), Component, swcHelpers.extends({}, x), Component, swcHelpers.extends({}, x, { y: 2 -})), React.createElement(Component, swcHelpers.extends({}, x, { +}), Component, swcHelpers.extends({}, x, { y: 2, z: !0 -})), React.createElement(Component, swcHelpers.extends({ +}), Component, swcHelpers.extends({ x: 1 -}, y)), React.createElement(Component, swcHelpers.extends({ +}, y), Component, swcHelpers.extends({ x: 1, y: "2" -}, z, z), React.createElement(Child, null)), React.createElement(Component, swcHelpers.extends({ +}, z, z), Child, Component, swcHelpers.extends({ x: "1" }, z = { y: 2 }, { z: 3 -}), "Text"); +}); diff --git a/crates/swc/tests/tsc-references/jsxReactTestSuite_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxReactTestSuite_es5.2.minified.js index 98abaf293e7..b19fcdeb062 100644 --- a/crates/swc/tests/tsc-references/jsxReactTestSuite_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxReactTestSuite_es5.2.minified.js @@ -1,38 +1,30 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("div", null, "text"), React.createElement("div", null, this.props.children), React.createElement("div", null, React.createElement("div", null, React.createElement("br", null)), React.createElement(Component, null, foo, React.createElement("br", null), bar), React.createElement("br", null)), React.createElement(Composite, null, this.props.children), React.createElement(Composite, null, React.createElement(Composite2, null)); +this.props.children, Component, foo, bar, Composite, this.props.children, Composite, Composite2; var x = React.createElement("div", { attr1: "foobar", attr2: "foobarbazbug", attr3: "foobarbazbug", attr4: "baz" }); -React.createElement("div", null, React.createElement("span", null), React.createElement("br", null)), React.createElement("div", { - attr1: "foo" -}, React.createElement("span", { - attr2: "bar" -})), React.createElement("div", null, "\xa0"), React.createElement("div", null, "\xa0 "), React.createElement("hasOwnProperty", null, "testing"), React.createElement(Component, { - constructor: "foo" -}), React.createElement(Namespace.Component, null), React.createElement(Namespace.DeepNamespace.Component, null), React.createElement(Component, swcHelpers.extends({}, x, { +Namespace.Component, Namespace.DeepNamespace.Component, Component, swcHelpers.extends({}, x, { y: 2, z: !0 -})), React.createElement(Component, swcHelpers.extends({}, this.props, { +}), Component, swcHelpers.extends({}, this.props, { sound: "moo" -})), React.createElement("font-face", null), React.createElement(Component, { - x: y -}), React.createElement("x-component", null), React.createElement(Component, swcHelpers.extends({}, x)), React.createElement(Component, swcHelpers.extends({}, x, { +}), Component, swcHelpers.extends({}, x), Component, swcHelpers.extends({}, x, { y: 2 -})), React.createElement(Component, swcHelpers.extends({}, x, { +}), Component, swcHelpers.extends({}, x, { y: 2, z: !0 -})), React.createElement(Component, swcHelpers.extends({ +}), Component, swcHelpers.extends({ x: 1 -}, y)), React.createElement(Component, swcHelpers.extends({ +}, y), Component, swcHelpers.extends({ x: 1, y: "2" -}, z, z), React.createElement(Child, null)), React.createElement(Component, swcHelpers.extends({ +}, z, z), Child, Component, swcHelpers.extends({ x: "1" }, z = { y: 2 }, { z: 3 -}), "Text"); +}); diff --git a/crates/swc/tests/tsc-references/jsxSpreadOverwritesAttributeStrict_es2015.2.minified.js b/crates/swc/tests/tsc-references/jsxSpreadOverwritesAttributeStrict_es2015.2.minified.js index 3380273c6ea..66c01590171 100644 --- a/crates/swc/tests/tsc-references/jsxSpreadOverwritesAttributeStrict_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxSpreadOverwritesAttributeStrict_es2015.2.minified.js @@ -1,25 +1,25 @@ import * as swcHelpers from "@swc/helpers"; -const React = require("react"), props = { +require("react"); +const props = { a: 1, b: 1 -}, Foo = (props1)=>React.createElement("div", null, props1.a) -; -React.createElement(Foo, swcHelpers.extends({}, props)), React.createElement(Foo, swcHelpers.extends({ +}; +swcHelpers.extends({}, props), swcHelpers.extends({ d: 1 -}, props)), React.createElement(Foo, swcHelpers.extends({ +}, props), swcHelpers.extends({ a: 1 -}, props)), React.createElement(Foo, swcHelpers.extends({ +}, props), swcHelpers.extends({ a: 1, b: 2 -}, props)), React.createElement(Foo, swcHelpers.extends({ +}, props), swcHelpers.extends({ a: 1, d: 1 }, props, { d: 1 -})), React.createElement(Foo, swcHelpers.extends({ +}), swcHelpers.extends({ a: 1, d: 1 }, props, { a: 1, d: 1 -})); +}); diff --git a/crates/swc/tests/tsc-references/jsxSpreadOverwritesAttributeStrict_es5.2.minified.js b/crates/swc/tests/tsc-references/jsxSpreadOverwritesAttributeStrict_es5.2.minified.js index 535aa706da4..bf1391d63a2 100644 --- a/crates/swc/tests/tsc-references/jsxSpreadOverwritesAttributeStrict_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/jsxSpreadOverwritesAttributeStrict_es5.2.minified.js @@ -1,26 +1,25 @@ import * as swcHelpers from "@swc/helpers"; -var React = require("react"), props = { +require("react"); +var props = { a: 1, b: 1 -}, Foo = function(props1) { - return React.createElement("div", null, props1.a); }; -React.createElement(Foo, swcHelpers.extends({}, props)), React.createElement(Foo, swcHelpers.extends({ +swcHelpers.extends({}, props), swcHelpers.extends({ d: 1 -}, props)), React.createElement(Foo, swcHelpers.extends({ +}, props), swcHelpers.extends({ a: 1 -}, props)), React.createElement(Foo, swcHelpers.extends({ +}, props), swcHelpers.extends({ a: 1, b: 2 -}, props)), React.createElement(Foo, swcHelpers.extends({ +}, props), swcHelpers.extends({ a: 1, d: 1 }, props, { d: 1 -})), React.createElement(Foo, swcHelpers.extends({ +}), swcHelpers.extends({ a: 1, d: 1 }, props, { a: 1, d: 1 -})); +}); diff --git a/crates/swc/tests/tsc-references/multiline_es2015.2.minified.js b/crates/swc/tests/tsc-references/multiline_es2015.2.minified.js index 41e702344e6..27acb6994ed 100644 --- a/crates/swc/tests/tsc-references/multiline_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/multiline_es2015.2.minified.js @@ -4,18 +4,3 @@ texts.push(100), texts.push(100), texts.push("100"); export function MyComponent() { return React.createElement("div", null); } -React.createElement("div", null, React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: "hooray" -})); diff --git a/crates/swc/tests/tsc-references/multiline_es5.2.minified.js b/crates/swc/tests/tsc-references/multiline_es5.2.minified.js index 3a54f6a8011..5b119ea9028 100644 --- a/crates/swc/tests/tsc-references/multiline_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/multiline_es5.2.minified.js @@ -4,18 +4,3 @@ texts.push(100), texts.push(100), texts.push("100"); export function MyComponent() { return React.createElement("div", null); } -React.createElement("div", null, React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: 100 -}), React.createElement(MyComponent, { - foo: "hooray" -})); diff --git a/crates/swc/tests/tsc-references/tsxAttributeErrors_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeErrors_es2015.2.minified.js index 0996fe679c1..4bc2f0e5f91 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeErrors_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeErrors_es2015.2.minified.js @@ -1,11 +1,4 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("div", { - text: 42 -}), React.createElement("div", { - width: "foo" -}), React.createElement("div", swcHelpers.extends({}, { +swcHelpers.extends({}, { text: 100 -})), React.createElement("span", { - foo: "bar", - bar: "foo" }); diff --git a/crates/swc/tests/tsc-references/tsxAttributeErrors_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeErrors_es5.2.minified.js index 0996fe679c1..4bc2f0e5f91 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeErrors_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeErrors_es5.2.minified.js @@ -1,11 +1,4 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("div", { - text: 42 -}), React.createElement("div", { - width: "foo" -}), React.createElement("div", swcHelpers.extends({}, { +swcHelpers.extends({}, { text: 100 -})), React.createElement("span", { - foo: "bar", - bar: "foo" }); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution10_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution10_es2015.2.minified.js index 27d7a007ec6..e7f1723a50c 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution10_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution10_es2015.2.minified.js @@ -1,10 +1,3 @@ export class MyComponent { render() {} } -React.createElement(MyComponent, { - bar: "world" -}), React.createElement(MyComponent, { - bar: !0 -}), React.createElement(MyComponent, { - "data-bar": "hello" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution10_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution10_es5.2.minified.js index 83b50a0f0fe..c6985636ec3 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution10_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution10_es5.2.minified.js @@ -6,10 +6,3 @@ export var MyComponent = function() { } return MyComponent.prototype.render = function() {}, MyComponent; }(); -React.createElement(MyComponent, { - bar: "world" -}), React.createElement(MyComponent, { - bar: !0 -}), React.createElement(MyComponent, { - "data-bar": "hello" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution11_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution11_es2015.2.minified.js index edc5fe95555..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution11_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution11_es2015.2.minified.js @@ -1,5 +0,0 @@ -React.createElement(class { - render() {} -}, { - bar: "world" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution11_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution11_es5.2.minified.js index cc800807dce..0d349fff906 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution11_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution11_es5.2.minified.js @@ -6,6 +6,3 @@ var MyComponent = function() { } return MyComponent.prototype.render = function() {}, MyComponent; }(); -React.createElement(MyComponent, { - bar: "world" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution12_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution12_es2015.2.minified.js index 82c6b6d5f08..163ba5323f3 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution12_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution12_es2015.2.minified.js @@ -1,2 +1 @@ -const T = TestMod.Test; -React.createElement(T, null), React.createElement(TestMod.Test, null); +TestMod.Test, TestMod.Test; diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution12_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution12_es5.2.minified.js index 8f9f75368ad..163ba5323f3 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution12_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution12_es5.2.minified.js @@ -1,2 +1 @@ -var T = TestMod.Test; -React.createElement(T, null), React.createElement(TestMod.Test, null); +TestMod.Test, TestMod.Test; diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution13_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution13_es2015.2.minified.js index 0bdccb0969b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution13_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution13_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement(function() {}, null); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution13_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution13_es5.2.minified.js index 0bdccb0969b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution13_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution13_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement(function() {}, null); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution15_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution15_es2015.2.minified.js index 9645ec3f3b6..fd362a7a393 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution15_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution15_es2015.2.minified.js @@ -4,13 +4,4 @@ class BigGreeter extends React.Component { return React.createElement("div", null, "Default hi"); } } -React.createElement(BigGreeter, { - prop1: "hello" -}), React.createElement(BigGreeter, { - ref: (input)=>{ - this.textInput = input; - } -}), React.createElement(BigGreeter, { - "data-extra": "hi" -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution15_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution15_es5.2.minified.js index dabe6dcac23..c938b49891c 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution15_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution15_es5.2.minified.js @@ -1,5 +1,5 @@ import * as swcHelpers from "@swc/helpers"; -var _this = this, React = require("react"), BigGreeter = function(_Component) { +var React = require("react"), BigGreeter = function(_Component) { "use strict"; swcHelpers.inherits(BigGreeter, _Component); var _super = swcHelpers.createSuper(BigGreeter); @@ -10,12 +10,3 @@ var _this = this, React = require("react"), BigGreeter = function(_Component) { return React.createElement("div", null, "Default hi"); }, BigGreeter; }(React.Component); -React.createElement(BigGreeter, { - prop1: "hello" -}), React.createElement(BigGreeter, { - ref: function(input) { - _this.textInput = input; - } -}), React.createElement(BigGreeter, { - "data-extra": "hi" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution16_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution16_es2015.2.minified.js index 5ea1d43d87d..0ec19904800 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution16_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution16_es2015.2.minified.js @@ -4,8 +4,3 @@ export class AddressComp extends React.Component { return null; } } -React.createElement(AddressComp, { - postalCode: "T1B 0L3", - street: "vancouver", - country: "CA" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution16_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution16_es5.2.minified.js index fc2dfe4e10c..40697d78e62 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution16_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution16_es5.2.minified.js @@ -11,8 +11,3 @@ export var AddressComp = function(_Component) { return null; }, AddressComp; }(React.Component); -React.createElement(AddressComp, { - postalCode: "T1B 0L3", - street: "vancouver", - country: "CA" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution1_es2015.2.minified.js index dff38aba2b4..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution1_es2015.2.minified.js @@ -1,23 +0,0 @@ -React.createElement("test1", { - x: 0 -}), React.createElement("test1", null), React.createElement("test1", { - "data-x": !0 -}), React.createElement("test2", { - reqd: "true" -}), React.createElement("test2", { - reqd: "true" -}), React.createElement("test1", { - x: "0" -}), React.createElement("test1", { - y: 0 -}), React.createElement("test1", { - y: "foo" -}), React.createElement("test1", { - x: "32" -}), React.createElement("test1", { - var: "10" -}), React.createElement("test2", null), React.createElement("test2", { - reqd: 10 -}), React.createElement("var", { - var: "var" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution1_es5.2.minified.js index dff38aba2b4..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution1_es5.2.minified.js @@ -1,23 +0,0 @@ -React.createElement("test1", { - x: 0 -}), React.createElement("test1", null), React.createElement("test1", { - "data-x": !0 -}), React.createElement("test2", { - reqd: "true" -}), React.createElement("test2", { - reqd: "true" -}), React.createElement("test1", { - x: "0" -}), React.createElement("test1", { - y: 0 -}), React.createElement("test1", { - y: "foo" -}), React.createElement("test1", { - x: "32" -}), React.createElement("test1", { - var: "10" -}), React.createElement("test2", null), React.createElement("test2", { - reqd: 10 -}), React.createElement("var", { - var: "var" -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution2_es2015.2.minified.js index 83a6bf74263..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution2_es2015.2.minified.js @@ -1,7 +0,0 @@ -React.createElement("test1", { - c1: (x)=>x.length -}), React.createElement("test1", { - "data-c1": (x)=>x.leng -}), React.createElement("test1", { - c1: (x)=>x.leng -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution2_es5.2.minified.js index f1944f3cece..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution2_es5.2.minified.js @@ -1,13 +0,0 @@ -React.createElement("test1", { - c1: function(x) { - return x.length; - } -}), React.createElement("test1", { - "data-c1": function(x) { - return x.leng; - } -}), React.createElement("test1", { - c1: function(x) { - return x.leng; - } -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution3_es2015.2.minified.js index 284719a1696..537eeb9fd4f 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution3_es2015.2.minified.js @@ -1,26 +1,26 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("test1", swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "foo" -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: 32 -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { y: 32 -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: 32, y: 32 }, { x: "ok" -})), React.createElement("test1", swcHelpers.extends({ +}), swcHelpers.extends({ x: "ok" }, { x: 32, y: 32 -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: "ok", y: 32, extra: 100 -})), React.createElement("test1", swcHelpers.extends({ +}), swcHelpers.extends({ x: 32 }, { x: "foo" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution3_es5.2.minified.js index 284719a1696..537eeb9fd4f 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution3_es5.2.minified.js @@ -1,26 +1,26 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("test1", swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "foo" -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: 32 -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { y: 32 -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: 32, y: 32 }, { x: "ok" -})), React.createElement("test1", swcHelpers.extends({ +}), swcHelpers.extends({ x: "ok" }, { x: 32, y: 32 -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: "ok", y: 32, extra: 100 -})), React.createElement("test1", swcHelpers.extends({ +}), swcHelpers.extends({ x: 32 }, { x: "foo" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution4_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution4_es2015.2.minified.js index 0247353a11f..d34ac955b15 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution4_es2015.2.minified.js @@ -1,6 +1,6 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("test1", swcHelpers.extends({}, { +swcHelpers.extends({}, { x: (n)=>0 -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: (n)=>n.len -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution4_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution4_es5.2.minified.js index 50fd4e81bb2..26921d18f16 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution4_es5.2.minified.js @@ -1,10 +1,10 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("test1", swcHelpers.extends({}, { +swcHelpers.extends({}, { x: function(n) { return 0; } -})), React.createElement("test1", swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: function(n) { return n.len; } -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution6_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution6_es2015.2.minified.js index 039d62daef5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution6_es2015.2.minified.js @@ -1,11 +0,0 @@ -React.createElement("test1", { - s: !0 -}), React.createElement("test1", { - n: "true" -}), React.createElement("test2", null), React.createElement("test1", { - n: !0 -}), React.createElement("test1", { - n: !1 -}), React.createElement("test2", { - n: !0 -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution6_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution6_es5.2.minified.js index 039d62daef5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution6_es5.2.minified.js @@ -1,11 +0,0 @@ -React.createElement("test1", { - s: !0 -}), React.createElement("test1", { - n: "true" -}), React.createElement("test2", null), React.createElement("test1", { - n: !0 -}), React.createElement("test1", { - n: !1 -}), React.createElement("test2", { - n: !0 -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution7_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution7_es2015.2.minified.js index 14670f3d6c5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution7_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution7_es2015.2.minified.js @@ -1,9 +0,0 @@ -React.createElement("test1", { - "data-foo": 32 -}), React.createElement("test1", { - "data-foo": "32" -}), React.createElement("test1", { - "data-bar": "32" -}), React.createElement("test1", { - "data-bar": 32 -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution7_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution7_es5.2.minified.js index 14670f3d6c5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution7_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution7_es5.2.minified.js @@ -1,9 +0,0 @@ -React.createElement("test1", { - "data-foo": 32 -}), React.createElement("test1", { - "data-foo": "32" -}), React.createElement("test1", { - "data-bar": "32" -}), React.createElement("test1", { - "data-bar": 32 -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution8_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution8_es2015.2.minified.js index 5d6255c92e4..809de5a2b54 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution8_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution8_es2015.2.minified.js @@ -1,3 +1,3 @@ var x; import * as swcHelpers from "@swc/helpers"; -React.createElement("test1", swcHelpers.extends({}, x)); +swcHelpers.extends({}, x); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution8_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution8_es5.2.minified.js index 5d6255c92e4..809de5a2b54 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution8_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution8_es5.2.minified.js @@ -1,3 +1,3 @@ var x; import * as swcHelpers from "@swc/helpers"; -React.createElement("test1", swcHelpers.extends({}, x)); +swcHelpers.extends({}, x); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution9_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution9_es2015.2.minified.js index 21037fb1a99..e7f1723a50c 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution9_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution9_es2015.2.minified.js @@ -1,8 +1,3 @@ export class MyComponent { render() {} } -React.createElement(MyComponent, { - foo: "bar" -}), React.createElement(MyComponent, { - foo: 0 -}); diff --git a/crates/swc/tests/tsc-references/tsxAttributeResolution9_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxAttributeResolution9_es5.2.minified.js index 3bf1a06ed9b..c6985636ec3 100644 --- a/crates/swc/tests/tsc-references/tsxAttributeResolution9_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxAttributeResolution9_es5.2.minified.js @@ -6,8 +6,3 @@ export var MyComponent = function() { } return MyComponent.prototype.render = function() {}, MyComponent; }(); -React.createElement(MyComponent, { - foo: "bar" -}), React.createElement(MyComponent, { - foo: 0 -}); diff --git a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution1_es2015.2.minified.js index 364d6e99d01..3513a59b26a 100644 --- a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution1_es2015.2.minified.js @@ -4,7 +4,4 @@ class Poisoned extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Poisoned, { - x: !0 -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution1_es5.2.minified.js index 1684ab6bae6..4b661393767 100644 --- a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution1_es5.2.minified.js @@ -10,6 +10,3 @@ var React = require("react"), Poisoned = function(_Component) { return React.createElement("div", null, "Hello"); }, Poisoned; }(React.Component); -React.createElement(Poisoned, { - x: !0 -}); diff --git a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution2_es2015.2.minified.js index 364d6e99d01..3513a59b26a 100644 --- a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution2_es2015.2.minified.js @@ -4,7 +4,4 @@ class Poisoned extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Poisoned, { - x: !0 -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution2_es5.2.minified.js index 1684ab6bae6..4b661393767 100644 --- a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution2_es5.2.minified.js @@ -10,6 +10,3 @@ var React = require("react"), Poisoned = function(_Component) { return React.createElement("div", null, "Hello"); }, Poisoned; }(React.Component); -React.createElement(Poisoned, { - x: !0 -}); diff --git a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution3_es2015.2.minified.js index 364d6e99d01..3513a59b26a 100644 --- a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution3_es2015.2.minified.js @@ -4,7 +4,4 @@ class Poisoned extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Poisoned, { - x: !0 -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution3_es5.2.minified.js index 1684ab6bae6..4b661393767 100644 --- a/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDefaultAttributesResolution3_es5.2.minified.js @@ -10,6 +10,3 @@ var React = require("react"), Poisoned = function(_Component) { return React.createElement("div", null, "Hello"); }, Poisoned; }(React.Component); -React.createElement(Poisoned, { - x: !0 -}); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName1_es2015.2.minified.js index b02e29779a5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName1_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("h1", null, " Hello World "); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName1_es5.2.minified.js index b02e29779a5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName1_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("h1", null, " Hello World "); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName2_es2015.2.minified.js index c9c8c09b7bd..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName2_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("customTag", null, " Hello World "); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName2_es5.2.minified.js index c9c8c09b7bd..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName2_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("customTag", null, " Hello World "); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName3_es2015.2.minified.js index b02e29779a5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName3_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("h1", null, " Hello World "); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName3_es5.2.minified.js index b02e29779a5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName3_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("h1", null, " Hello World "); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName4_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName4_es2015.2.minified.js index b02e29779a5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName4_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("h1", null, " Hello World "); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName4_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName4_es5.2.minified.js index b02e29779a5..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName4_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("h1", null, " Hello World "); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName6_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName6_es2015.2.minified.js index 035f31a4e30..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName6_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("h1", null); diff --git a/crates/swc/tests/tsc-references/tsxDynamicTagName6_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxDynamicTagName6_es5.2.minified.js index 035f31a4e30..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxDynamicTagName6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxDynamicTagName6_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("h1", null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution10_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution10_es2015.2.minified.js index f83a7ea4d35..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution10_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution10_es2015.2.minified.js @@ -1,7 +0,0 @@ -var Obj1, Obj2; -React.createElement(Obj1, { - x: 10 -}), React.createElement(Obj2, { - x: 32, - render: 100 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution10_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution10_es5.2.minified.js index f83a7ea4d35..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution10_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution10_es5.2.minified.js @@ -1,7 +0,0 @@ -var Obj1, Obj2; -React.createElement(Obj1, { - x: 10 -}), React.createElement(Obj2, { - x: 32, - render: 100 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution11_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution11_es2015.2.minified.js index 4e6b3f7b2f4..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution11_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution11_es2015.2.minified.js @@ -1,8 +0,0 @@ -var Obj1, Obj2, Obj3; -React.createElement(Obj1, { - x: 10 -}), React.createElement(Obj2, { - x: 10 -}), React.createElement(Obj3, { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution11_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution11_es5.2.minified.js index 4e6b3f7b2f4..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution11_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution11_es5.2.minified.js @@ -1,8 +0,0 @@ -var Obj1, Obj2, Obj3; -React.createElement(Obj1, { - x: 10 -}), React.createElement(Obj2, { - x: 10 -}), React.createElement(Obj3, { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution12_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution12_es2015.2.minified.js index 0743fc10183..7e64ae9a429 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution12_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution12_es2015.2.minified.js @@ -1,13 +1,3 @@ -var Obj1, Obj2, Obj3, attributes, Obj4; +var attributes; import * as swcHelpers from "@swc/helpers"; -React.createElement(Obj1, { - x: 10 -}), React.createElement(Obj2, { - x: 10 -}), React.createElement(Obj3, { - x: 10 -}), React.createElement(Obj3, swcHelpers.extends({}, attributes)), React.createElement(Obj3, swcHelpers.extends({}, {})), React.createElement(Obj4, { - x: 10 -}), React.createElement(Obj4, { - x: "10" -}); +swcHelpers.extends({}, attributes), swcHelpers.extends({}, {}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution12_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution12_es5.2.minified.js index 0743fc10183..7e64ae9a429 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution12_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution12_es5.2.minified.js @@ -1,13 +1,3 @@ -var Obj1, Obj2, Obj3, attributes, Obj4; +var attributes; import * as swcHelpers from "@swc/helpers"; -React.createElement(Obj1, { - x: 10 -}), React.createElement(Obj2, { - x: 10 -}), React.createElement(Obj3, { - x: 10 -}), React.createElement(Obj3, swcHelpers.extends({}, attributes)), React.createElement(Obj3, swcHelpers.extends({}, {})), React.createElement(Obj4, { - x: 10 -}), React.createElement(Obj4, { - x: "10" -}); +swcHelpers.extends({}, attributes), swcHelpers.extends({}, {}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution13_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution13_es2015.2.minified.js index 5f88a76233f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution13_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution13_es2015.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("obj1", { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution13_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution13_es5.2.minified.js index 5f88a76233f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution13_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution13_es5.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("obj1", { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution14_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution14_es2015.2.minified.js index 5f88a76233f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution14_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution14_es2015.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("obj1", { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution14_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution14_es5.2.minified.js index 5f88a76233f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution14_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution14_es5.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("obj1", { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution15_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution15_es2015.2.minified.js index 2454ddb01bc..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution15_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution15_es2015.2.minified.js @@ -1,4 +0,0 @@ -var Obj1; -React.createElement(Obj1, { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution15_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution15_es5.2.minified.js index 2454ddb01bc..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution15_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution15_es5.2.minified.js @@ -1,4 +0,0 @@ -var Obj1; -React.createElement(Obj1, { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution16_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution16_es2015.2.minified.js index 5f88a76233f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution16_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution16_es2015.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("obj1", { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution16_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution16_es5.2.minified.js index 5f88a76233f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution16_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution16_es5.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("obj1", { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution17_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution17_es2015.2.minified.js index e5597400fd1..3469140f7db 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution17_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution17_es2015.2.minified.js @@ -1,3 +1,3 @@ const s1 = require("elements1"); -require("elements2"), React.createElement(s1.MyElement, null); +require("elements2"), s1.MyElement; export { }; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution17_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution17_es5.2.minified.js index 3298216fc32..21c2e3114c0 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution17_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution17_es5.2.minified.js @@ -1,3 +1,3 @@ var s1 = require("elements1"); -require("elements2"), React.createElement(s1.MyElement, null); +require("elements2"), s1.MyElement; export { }; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution18_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution18_es2015.2.minified.js index 3d654364e8d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution18_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution18_es2015.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("div", { - n: "x" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution18_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution18_es5.2.minified.js index 3d654364e8d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution18_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution18_es5.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("div", { - n: "x" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.2.minified.js index 8fdb28e9dca..0902842d1cf 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution19_es2015.2.minified.js @@ -1,4 +1,3 @@ import * as React from "react"; export class MyClass { } -React.createElement(MyClass, null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution19_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution19_es5.2.minified.js index fe7d4c25e02..fb04f152daa 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution19_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution19_es5.2.minified.js @@ -4,4 +4,3 @@ export var MyClass = function() { "use strict"; swcHelpers.classCallCheck(this, MyClass); }; -React.createElement(MyClass, null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution1_es2015.2.minified.js index 24a149d38ca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution1_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null), React.createElement("span", null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution1_es5.2.minified.js index 24a149d38ca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution1_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null), React.createElement("span", null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution2_es2015.2.minified.js index 24a149d38ca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution2_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null), React.createElement("span", null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution2_es5.2.minified.js index 24a149d38ca..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution2_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null), React.createElement("span", null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution3_es2015.2.minified.js index 4433ee169fe..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution3_es2015.2.minified.js @@ -1,5 +0,0 @@ -React.createElement("div", { - n: "x" -}), React.createElement("span", { - w: "err" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution3_es5.2.minified.js index 4433ee169fe..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution3_es5.2.minified.js @@ -1,5 +0,0 @@ -React.createElement("div", { - n: "x" -}), React.createElement("span", { - w: "err" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution4_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution4_es2015.2.minified.js index 2393976c7bb..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution4_es2015.2.minified.js @@ -1,7 +0,0 @@ -React.createElement("div", { - n: "x" -}), React.createElement("span", { - m: "ok" -}), React.createElement("span", { - q: "" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution4_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution4_es5.2.minified.js index 2393976c7bb..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution4_es5.2.minified.js @@ -1,7 +0,0 @@ -React.createElement("div", { - n: "x" -}), React.createElement("span", { - m: "ok" -}), React.createElement("span", { - q: "" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution5_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution5_es2015.2.minified.js index 3d654364e8d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution5_es2015.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("div", { - n: "x" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution5_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution5_es5.2.minified.js index 3d654364e8d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution5_es5.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("div", { - n: "x" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution6_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution6_es2015.2.minified.js index 3d654364e8d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution6_es2015.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("div", { - n: "x" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution6_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution6_es5.2.minified.js index 3d654364e8d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution6_es5.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("div", { - n: "x" -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution7_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution7_es2015.2.minified.js index 3167647f011..3545eb181eb 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution7_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution7_es2015.2.minified.js @@ -2,11 +2,7 @@ var my, q; !function(my1) { var div; my1.div = div; -}(my || (my = {})), React.createElement(my.div, { - n: "x" -}), React.createElement(my.other, null), function(q) { +}(my || (my = {})), my.div, my.other, function(q) { var mine = my; - React.createElement(mine.div, { - n: "x" - }), React.createElement(mine.non, null); + mine.div, mine.non; }(q || (q = {})); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution7_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution7_es5.2.minified.js index 3167647f011..3545eb181eb 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution7_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution7_es5.2.minified.js @@ -2,11 +2,7 @@ var my, q; !function(my1) { var div; my1.div = div; -}(my || (my = {})), React.createElement(my.div, { - n: "x" -}), React.createElement(my.other, null), function(q) { +}(my || (my = {})), my.div, my.other, function(q) { var mine = my; - React.createElement(mine.div, { - n: "x" - }), React.createElement(mine.non, null); + mine.div, mine.non; }(q || (q = {})); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution8_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution8_es2015.2.minified.js index 4225b18828b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution8_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution8_es2015.2.minified.js @@ -1,6 +0,0 @@ -var Obj1, Obj2, Obj3; -React.createElement(3, null), React.createElement(function() { - return null; -}, null), React.createElement(function() { - return 42; -}, null), React.createElement(Obj1, null), React.createElement(Obj2, null), React.createElement(Obj3, null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution8_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution8_es5.2.minified.js index 4225b18828b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution8_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution8_es5.2.minified.js @@ -1,6 +0,0 @@ -var Obj1, Obj2, Obj3; -React.createElement(3, null), React.createElement(function() { - return null; -}, null), React.createElement(function() { - return 42; -}, null), React.createElement(Obj1, null), React.createElement(Obj2, null), React.createElement(Obj3, null); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution9_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution9_es2015.2.minified.js index 473d771cbf1..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution9_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution9_es2015.2.minified.js @@ -1,4 +0,0 @@ -var Obj1, Obj2, Obj3; -React.createElement(Obj1, null), React.createElement(Obj2, null), React.createElement(Obj3, { - x: 42 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution9_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution9_es5.2.minified.js index 473d771cbf1..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution9_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution9_es5.2.minified.js @@ -1,4 +0,0 @@ -var Obj1, Obj2, Obj3; -React.createElement(Obj1, null), React.createElement(Obj2, null), React.createElement(Obj3, { - x: 42 -}); diff --git a/crates/swc/tests/tsc-references/tsxElementResolution_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution_es2015.2.minified.js index 1f5252d4686..9b0b35af2f4 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution_es2015.2.minified.js @@ -1,6 +1,3 @@ var Dotted; (Dotted || (Dotted = {})).Name = class { -}, React.createElement("foundFirst", { - x: "hello" -}), React.createElement("string_named", null), React.createElement(class { -}, null), React.createElement(Dotted.Name, null); +}, Dotted.Name; diff --git a/crates/swc/tests/tsc-references/tsxElementResolution_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxElementResolution_es5.2.minified.js index 4dab63aa61e..b42724c7b4c 100644 --- a/crates/swc/tests/tsc-references/tsxElementResolution_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxElementResolution_es5.2.minified.js @@ -12,6 +12,4 @@ var Dotted, foundFirst = function() { swcHelpers.classCallCheck(this, Name); }; Dotted1.Name = Name; -}(Dotted || (Dotted = {})), React.createElement("foundFirst", { - x: "hello" -}), React.createElement("string_named", null), React.createElement(Other, null), React.createElement(Dotted.Name, null); +}(Dotted || (Dotted = {})), Dotted.Name; diff --git a/crates/swc/tests/tsc-references/tsxEmit1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxEmit1_es2015.2.minified.js index 1e94ac83564..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxEmit1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxEmit1_es2015.2.minified.js @@ -1,26 +0,0 @@ -var p; -React.createElement("div", null), React.createElement("div", { - x: "1" -}), React.createElement("div", { - x: "1" -}), React.createElement("div", { - x: "1", - y: "0" -}), React.createElement("div", { - x: 0, - y: "0" -}), React.createElement("div", { - x: "1", - y: "0" -}), React.createElement("div", { - x: p, - y: "p" -}), React.createElement("div", null), React.createElement("div", { - n: "m" -}, "foo"), React.createElement("div", { - n: "m" -}, p), React.createElement("div", { - n: "m" -}, !1), React.createElement("div", { - n: "m" -}, !1), React.createElement("div", null, " "), React.createElement("div", null, " ", p, " "), React.createElement("div", null, p); diff --git a/crates/swc/tests/tsc-references/tsxEmit1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxEmit1_es5.2.minified.js index 0084c4d9f83..eab76685307 100644 --- a/crates/swc/tests/tsc-references/tsxEmit1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxEmit1_es5.2.minified.js @@ -1,59 +1,18 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("div", null), React.createElement("div", { - x: "1" -}), React.createElement("div", { - x: "1" -}), React.createElement("div", { - x: "1", - y: "0" -}), React.createElement("div", { - x: 0, - y: "0" -}), React.createElement("div", { - x: "1", - y: "0" -}), React.createElement("div", { - x: p, - y: "p" -}), React.createElement("div", null), React.createElement("div", { - n: "m" -}, "foo"), React.createElement("div", { - n: "m" -}, p), React.createElement("div", { - n: "m" -}, !1), React.createElement("div", { - n: "m" -}, !1); var p, SomeClass = function() { "use strict"; function SomeClass() { swcHelpers.classCallCheck(this, SomeClass); } return SomeClass.prototype.f = function() { - var _this = this; - React.createElement("div", null, function() { - return _this; - }), React.createElement("div", null, [ + [ p ].concat(swcHelpers.toConsumableArray(p), [ p - ])), React.createElement("div", null, { - p: p - }), React.createElement("div", { - a: function() { - return _this; - } - }), React.createElement("div", { - a: [ - p - ].concat(swcHelpers.toConsumableArray(p), [ - p - ]) - }), React.createElement("div", { - a: { - p: p - } - }); + ]), [ + p + ].concat(swcHelpers.toConsumableArray(p), [ + p + ]); }, SomeClass; }(); -React.createElement("div", null, " "), React.createElement("div", null, " ", p, " "), React.createElement("div", null, p); diff --git a/crates/swc/tests/tsc-references/tsxEmit2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxEmit2_es2015.2.minified.js index 70e287441d7..64ff0e17b16 100644 --- a/crates/swc/tests/tsc-references/tsxEmit2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxEmit2_es2015.2.minified.js @@ -1,11 +1,11 @@ var p1, p2, p3; import * as swcHelpers from "@swc/helpers"; -React.createElement("div", swcHelpers.extends({}, p1), p2), React.createElement("div", swcHelpers.extends({}, p1), p2), React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({}, p1), swcHelpers.extends({}, p1), swcHelpers.extends({ x: p3 -}, p1), p2), React.createElement("div", swcHelpers.extends({}, p1, { +}, p1), swcHelpers.extends({}, p1, { x: p3 -}), p2), React.createElement("div", swcHelpers.extends({ +}), swcHelpers.extends({ x: p2 }, p1, { y: p3 -}), p2); +}); diff --git a/crates/swc/tests/tsc-references/tsxEmit2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxEmit2_es5.2.minified.js index 70e287441d7..64ff0e17b16 100644 --- a/crates/swc/tests/tsc-references/tsxEmit2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxEmit2_es5.2.minified.js @@ -1,11 +1,11 @@ var p1, p2, p3; import * as swcHelpers from "@swc/helpers"; -React.createElement("div", swcHelpers.extends({}, p1), p2), React.createElement("div", swcHelpers.extends({}, p1), p2), React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({}, p1), swcHelpers.extends({}, p1), swcHelpers.extends({ x: p3 -}, p1), p2), React.createElement("div", swcHelpers.extends({}, p1, { +}, p1), swcHelpers.extends({}, p1, { x: p3 -}), p2), React.createElement("div", swcHelpers.extends({ +}), swcHelpers.extends({ x: p2 }, p1, { y: p3 -}), p2); +}); diff --git a/crates/swc/tests/tsc-references/tsxEmit3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxEmit3_es2015.2.minified.js index a11dc1a3628..367148b0361 100644 --- a/crates/swc/tests/tsc-references/tsxEmit3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxEmit3_es2015.2.minified.js @@ -4,6 +4,4 @@ var M; constructor(){} }, (M1.S || (M1.S = {})).Bar = class { }; -}(M || (M = {})), function(M2) { - Foo, React.createElement(Foo, null), M2.S || (M2.S = {}), Foo, React.createElement(Foo, null), Bar, React.createElement(Bar, null); -}(M || (M = {})), M || (M = {}), S.Bar, React.createElement(S.Bar, null), M || (M = {}), Foo, React.createElement(Foo, null); +}(M || (M = {})), M || (M = {}), S.Bar, S.Bar; diff --git a/crates/swc/tests/tsc-references/tsxEmit3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxEmit3_es5.2.minified.js index 7ff62818987..1dcbc4cc4b8 100644 --- a/crates/swc/tests/tsc-references/tsxEmit3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxEmit3_es5.2.minified.js @@ -9,6 +9,4 @@ import * as swcHelpers from "@swc/helpers"; "use strict"; swcHelpers.classCallCheck(this, Bar); }, S.Bar = Bar; -}(M || (M = {})), function(M2) { - Foo, React.createElement(Foo, null), M2.S || (M2.S = {}), Foo, React.createElement(Foo, null), Bar, React.createElement(Bar, null); -}(M || (M = {})), M || (M = {}), S.Bar, React.createElement(S.Bar, null), M || (M = {}), Foo, React.createElement(Foo, null); +}(M || (M = {})), M || (M = {}), S.Bar, S.Bar; diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es2015.2.minified.js index 249b064e497..ee6e92468e3 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es2015.2.minified.js @@ -1,5 +1,3 @@ import * as swcHelpers from "@swc/helpers"; import Main from "mod"; -React.createElement(Foo, { - handler: Main -}), React.createElement(Foo, swcHelpers.extends({}, Main)); +Foo, swcHelpers.extends({}, Main); diff --git a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es5.2.minified.js index 249b064e497..ee6e92468e3 100644 --- a/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxExternalModuleEmit2_es5.2.minified.js @@ -1,5 +1,3 @@ import * as swcHelpers from "@swc/helpers"; import Main from "mod"; -React.createElement(Foo, { - handler: Main -}), React.createElement(Foo, swcHelpers.extends({}, Main)); +Foo, swcHelpers.extends({}, Main); diff --git a/crates/swc/tests/tsc-references/tsxFragmentPreserveEmit_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxFragmentPreserveEmit_es2015.2.minified.js index 0a1a078335e..5b560b0bedc 100644 --- a/crates/swc/tests/tsc-references/tsxFragmentPreserveEmit_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxFragmentPreserveEmit_es2015.2.minified.js @@ -1 +1 @@ -React.createElement(React.Fragment, null), React.createElement(React.Fragment, null), React.createElement(React.Fragment, null), React.createElement(React.Fragment, null, "hi"), React.createElement(React.Fragment, null, React.createElement("span", null, "hi"), React.createElement("div", null, "bye")), React.createElement(React.Fragment, null, React.createElement("span", null, "1"), React.createElement(React.Fragment, null, React.createElement("span", null, "2.1"), React.createElement("span", null, "2.2")), React.createElement("span", null, "3")), React.createElement(React.Fragment, null, "#"); +React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment; diff --git a/crates/swc/tests/tsc-references/tsxFragmentPreserveEmit_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxFragmentPreserveEmit_es5.2.minified.js index 0a1a078335e..5b560b0bedc 100644 --- a/crates/swc/tests/tsc-references/tsxFragmentPreserveEmit_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxFragmentPreserveEmit_es5.2.minified.js @@ -1 +1 @@ -React.createElement(React.Fragment, null), React.createElement(React.Fragment, null), React.createElement(React.Fragment, null), React.createElement(React.Fragment, null, "hi"), React.createElement(React.Fragment, null, React.createElement("span", null, "hi"), React.createElement("div", null, "bye")), React.createElement(React.Fragment, null, React.createElement("span", null, "1"), React.createElement(React.Fragment, null, React.createElement("span", null, "2.1"), React.createElement("span", null, "2.2")), React.createElement("span", null, "3")), React.createElement(React.Fragment, null, "#"); +React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment; diff --git a/crates/swc/tests/tsc-references/tsxFragmentReactEmit_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxFragmentReactEmit_es2015.2.minified.js index 0a1a078335e..5b560b0bedc 100644 --- a/crates/swc/tests/tsc-references/tsxFragmentReactEmit_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxFragmentReactEmit_es2015.2.minified.js @@ -1 +1 @@ -React.createElement(React.Fragment, null), React.createElement(React.Fragment, null), React.createElement(React.Fragment, null), React.createElement(React.Fragment, null, "hi"), React.createElement(React.Fragment, null, React.createElement("span", null, "hi"), React.createElement("div", null, "bye")), React.createElement(React.Fragment, null, React.createElement("span", null, "1"), React.createElement(React.Fragment, null, React.createElement("span", null, "2.1"), React.createElement("span", null, "2.2")), React.createElement("span", null, "3")), React.createElement(React.Fragment, null, "#"); +React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment; diff --git a/crates/swc/tests/tsc-references/tsxFragmentReactEmit_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxFragmentReactEmit_es5.2.minified.js index 0a1a078335e..5b560b0bedc 100644 --- a/crates/swc/tests/tsc-references/tsxFragmentReactEmit_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxFragmentReactEmit_es5.2.minified.js @@ -1 +1 @@ -React.createElement(React.Fragment, null), React.createElement(React.Fragment, null), React.createElement(React.Fragment, null), React.createElement(React.Fragment, null, "hi"), React.createElement(React.Fragment, null, React.createElement("span", null, "hi"), React.createElement("div", null, "bye")), React.createElement(React.Fragment, null, React.createElement("span", null, "1"), React.createElement(React.Fragment, null, React.createElement("span", null, "2.1"), React.createElement("span", null, "2.2")), React.createElement("span", null, "3")), React.createElement(React.Fragment, null, "#"); +React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment, React.Fragment; diff --git a/crates/swc/tests/tsc-references/tsxInArrowFunction_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxInArrowFunction_es2015.2.minified.js index 076d90c2dcc..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxInArrowFunction_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxInArrowFunction_es2015.2.minified.js @@ -1,13 +0,0 @@ -React.createElement("div", null, ()=>React.createElement("div", { - text: "wat" - }) -), React.createElement("div", null, (x)=>React.createElement("div", { - text: "wat" - }) -), React.createElement("div", null, ()=>React.createElement("div", { - text: "wat" - }) -), React.createElement("div", null, ()=>React.createElement("div", { - text: "wat" - }) -); diff --git a/crates/swc/tests/tsc-references/tsxInArrowFunction_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxInArrowFunction_es5.2.minified.js index f70ffb66451..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxInArrowFunction_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxInArrowFunction_es5.2.minified.js @@ -1,17 +0,0 @@ -React.createElement("div", null, function() { - return React.createElement("div", { - text: "wat" - }); -}), React.createElement("div", null, function(x) { - return React.createElement("div", { - text: "wat" - }); -}), React.createElement("div", null, function() { - return React.createElement("div", { - text: "wat" - }); -}), React.createElement("div", null, function() { - return React.createElement("div", { - text: "wat" - }); -}); diff --git a/crates/swc/tests/tsc-references/tsxIntrinsicAttributeErrors_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxIntrinsicAttributeErrors_es2015.2.minified.js index 411b089f7e0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxIntrinsicAttributeErrors_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxIntrinsicAttributeErrors_es2015.2.minified.js @@ -1,4 +0,0 @@ -var E; -React.createElement(E, { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxIntrinsicAttributeErrors_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxIntrinsicAttributeErrors_es5.2.minified.js index 411b089f7e0..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxIntrinsicAttributeErrors_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxIntrinsicAttributeErrors_es5.2.minified.js @@ -1,4 +0,0 @@ -var E; -React.createElement(E, { - x: 10 -}); diff --git a/crates/swc/tests/tsc-references/tsxLibraryManagedAttributes_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxLibraryManagedAttributes_es2015.2.minified.js index b3a2e362de2..6941cbdd0d1 100644 --- a/crates/swc/tests/tsc-references/tsxLibraryManagedAttributes_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxLibraryManagedAttributes_es2015.2.minified.js @@ -6,57 +6,14 @@ Component.propTypes = { baz: PropTypes.string.isRequired }, Component.defaultProps = { foo: 42 -}, React.createElement(Component, { - foo: 12, - bar: "yes", - baz: "yeah" -}), React.createElement(Component, { - foo: 12 -}), React.createElement(Component, { - bar: "yes", - baz: "yeah" -}), React.createElement(Component, { - bar: "yes", - baz: "yo", - bat: "ohno" -}), React.createElement(Component, { - foo: 12, - bar: null, - baz: "cool" -}), React.createElement(Component, { - foo: 12, - bar: "yeah", - baz: null -}); -class JustPropTypes extends ReactComponent { -} -JustPropTypes.propTypes = { +}, (class extends ReactComponent { +}).propTypes = { foo: PropTypes.number, bar: PropTypes.node.isRequired -}, React.createElement(JustPropTypes, { - foo: 12, - bar: "ok" -}), React.createElement(JustPropTypes, { - foo: "no" -}), React.createElement(JustPropTypes, { - foo: null, - bar: "ok" -}), React.createElement(JustPropTypes, { - foo: 12, - bar: null -}); -class JustDefaultProps extends ReactComponent { -} -JustDefaultProps.defaultProps = { +}, (class extends ReactComponent { +}).defaultProps = { foo: 42 -}, React.createElement(JustDefaultProps, { - foo: 12 -}), React.createElement(JustDefaultProps, { - foo: 12, - bar: "ok" -}), React.createElement(JustDefaultProps, { - foo: "no" -}); +}; class BothWithSpecifiedGeneric extends ReactComponent { } BothWithSpecifiedGeneric.propTypes = { @@ -65,54 +22,11 @@ BothWithSpecifiedGeneric.propTypes = { baz: PropTypes.number.isRequired }, BothWithSpecifiedGeneric.defaultProps = { foo: "yo" -}, React.createElement(BothWithSpecifiedGeneric, { - foo: "fine", - bar: "yes", - baz: 12 -}), React.createElement(BothWithSpecifiedGeneric, { - foo: "no" -}), React.createElement(BothWithSpecifiedGeneric, { - bar: "yes", - baz: 12 -}), React.createElement(BothWithSpecifiedGeneric, { - bar: "yes", - baz: 12, - bat: "ohno" -}), React.createElement(BothWithSpecifiedGeneric, { - foo: "no", - bar: null, - baz: 0 -}), React.createElement(BothWithSpecifiedGeneric, { - foo: "eh", - bar: "yeah", - baz: null -}); -class JustPropTypesWithSpecifiedGeneric extends ReactComponent { -} -JustPropTypesWithSpecifiedGeneric.propTypes = { +}, (class extends ReactComponent { +}).propTypes = { foo: PropTypes.string, bar: PropTypes.node.isRequired -}, React.createElement(JustPropTypesWithSpecifiedGeneric, { - foo: "nice", - bar: "ok" -}), React.createElement(JustPropTypesWithSpecifiedGeneric, { - foo: 12 -}), React.createElement(JustPropTypesWithSpecifiedGeneric, { - foo: null, - bar: "ok" -}), React.createElement(JustPropTypesWithSpecifiedGeneric, { - foo: "cool", - bar: null -}); -class JustDefaultPropsWithSpecifiedGeneric extends ReactComponent { -} -JustDefaultPropsWithSpecifiedGeneric.defaultProps = { +}, (class extends ReactComponent { +}).defaultProps = { foo: "no" -}, React.createElement(JustDefaultPropsWithSpecifiedGeneric, { - foo: "eh" -}), React.createElement(JustDefaultPropsWithSpecifiedGeneric, { - foo: "no", - bar: "ok" -}), React.createElement(JustDefaultPropsWithSpecifiedGeneric, { - foo: 12 -}), React.createElement(JustDefaultPropsWithSpecifiedGeneric, null); +}; diff --git a/crates/swc/tests/tsc-references/tsxLibraryManagedAttributes_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxLibraryManagedAttributes_es5.2.minified.js index 302f1386441..f9f5c0c29e9 100644 --- a/crates/swc/tests/tsc-references/tsxLibraryManagedAttributes_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxLibraryManagedAttributes_es5.2.minified.js @@ -14,28 +14,7 @@ Component.propTypes = { baz: PropTypes.string.isRequired }, Component.defaultProps = { foo: 42 -}, React.createElement(Component, { - foo: 12, - bar: "yes", - baz: "yeah" -}), React.createElement(Component, { - foo: 12 -}), React.createElement(Component, { - bar: "yes", - baz: "yeah" -}), React.createElement(Component, { - bar: "yes", - baz: "yo", - bat: "ohno" -}), React.createElement(Component, { - foo: 12, - bar: null, - baz: "cool" -}), React.createElement(Component, { - foo: 12, - bar: "yeah", - baz: null -}); +}; var JustPropTypes = function(ReactComponent) { "use strict"; swcHelpers.inherits(JustPropTypes, ReactComponent); @@ -48,18 +27,7 @@ var JustPropTypes = function(ReactComponent) { JustPropTypes.propTypes = { foo: PropTypes.number, bar: PropTypes.node.isRequired -}, React.createElement(JustPropTypes, { - foo: 12, - bar: "ok" -}), React.createElement(JustPropTypes, { - foo: "no" -}), React.createElement(JustPropTypes, { - foo: null, - bar: "ok" -}), React.createElement(JustPropTypes, { - foo: 12, - bar: null -}); +}; var JustDefaultProps = function(ReactComponent) { "use strict"; swcHelpers.inherits(JustDefaultProps, ReactComponent); @@ -71,14 +39,7 @@ var JustDefaultProps = function(ReactComponent) { }(ReactComponent); JustDefaultProps.defaultProps = { foo: 42 -}, React.createElement(JustDefaultProps, { - foo: 12 -}), React.createElement(JustDefaultProps, { - foo: 12, - bar: "ok" -}), React.createElement(JustDefaultProps, { - foo: "no" -}); +}; var BothWithSpecifiedGeneric = function(ReactComponent) { "use strict"; swcHelpers.inherits(BothWithSpecifiedGeneric, ReactComponent); @@ -94,28 +55,7 @@ BothWithSpecifiedGeneric.propTypes = { baz: PropTypes.number.isRequired }, BothWithSpecifiedGeneric.defaultProps = { foo: "yo" -}, React.createElement(BothWithSpecifiedGeneric, { - foo: "fine", - bar: "yes", - baz: 12 -}), React.createElement(BothWithSpecifiedGeneric, { - foo: "no" -}), React.createElement(BothWithSpecifiedGeneric, { - bar: "yes", - baz: 12 -}), React.createElement(BothWithSpecifiedGeneric, { - bar: "yes", - baz: 12, - bat: "ohno" -}), React.createElement(BothWithSpecifiedGeneric, { - foo: "no", - bar: null, - baz: 0 -}), React.createElement(BothWithSpecifiedGeneric, { - foo: "eh", - bar: "yeah", - baz: null -}); +}; var JustPropTypesWithSpecifiedGeneric = function(ReactComponent) { "use strict"; swcHelpers.inherits(JustPropTypesWithSpecifiedGeneric, ReactComponent); @@ -128,18 +68,7 @@ var JustPropTypesWithSpecifiedGeneric = function(ReactComponent) { JustPropTypesWithSpecifiedGeneric.propTypes = { foo: PropTypes.string, bar: PropTypes.node.isRequired -}, React.createElement(JustPropTypesWithSpecifiedGeneric, { - foo: "nice", - bar: "ok" -}), React.createElement(JustPropTypesWithSpecifiedGeneric, { - foo: 12 -}), React.createElement(JustPropTypesWithSpecifiedGeneric, { - foo: null, - bar: "ok" -}), React.createElement(JustPropTypesWithSpecifiedGeneric, { - foo: "cool", - bar: null -}); +}; var JustDefaultPropsWithSpecifiedGeneric = function(ReactComponent) { "use strict"; swcHelpers.inherits(JustDefaultPropsWithSpecifiedGeneric, ReactComponent); @@ -151,11 +80,4 @@ var JustDefaultPropsWithSpecifiedGeneric = function(ReactComponent) { }(ReactComponent); JustDefaultPropsWithSpecifiedGeneric.defaultProps = { foo: "no" -}, React.createElement(JustDefaultPropsWithSpecifiedGeneric, { - foo: "eh" -}), React.createElement(JustDefaultPropsWithSpecifiedGeneric, { - foo: "no", - bar: "ok" -}), React.createElement(JustDefaultPropsWithSpecifiedGeneric, { - foo: 12 -}), React.createElement(JustDefaultPropsWithSpecifiedGeneric, null); +}; diff --git a/crates/swc/tests/tsc-references/tsxNoJsx_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxNoJsx_es2015.2.minified.js index 1ec941382b2..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxNoJsx_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxNoJsx_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("nope", null); diff --git a/crates/swc/tests/tsc-references/tsxNoJsx_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxNoJsx_es5.2.minified.js index 1ec941382b2..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxNoJsx_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxNoJsx_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("nope", null); diff --git a/crates/swc/tests/tsc-references/tsxOpeningClosingNames_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxOpeningClosingNames_es2015.2.minified.js index 9b942672508..2631227cd0b 100644 --- a/crates/swc/tests/tsc-references/tsxOpeningClosingNames_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxOpeningClosingNames_es2015.2.minified.js @@ -1 +1 @@ -React.createElement(A.B.C.D, null, "foo"); +A.B.C.D; diff --git a/crates/swc/tests/tsc-references/tsxOpeningClosingNames_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxOpeningClosingNames_es5.2.minified.js index 9b942672508..2631227cd0b 100644 --- a/crates/swc/tests/tsc-references/tsxOpeningClosingNames_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxOpeningClosingNames_es5.2.minified.js @@ -1 +1 @@ -React.createElement(A.B.C.D, null, "foo"); +A.B.C.D; diff --git a/crates/swc/tests/tsc-references/tsxParseTests1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxParseTests1_es2015.2.minified.js index db5c62d9459..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxParseTests1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxParseTests1_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null, React.createElement("div", null, React.createElement("span", null, React.createElement("div", null)))); diff --git a/crates/swc/tests/tsc-references/tsxParseTests1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxParseTests1_es5.2.minified.js index db5c62d9459..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxParseTests1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxParseTests1_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null, React.createElement("div", null, React.createElement("span", null, React.createElement("div", null)))); diff --git a/crates/swc/tests/tsc-references/tsxParseTests2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxParseTests2_es2015.2.minified.js index 3cd05d5f9f2..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxParseTests2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxParseTests2_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null); diff --git a/crates/swc/tests/tsc-references/tsxParseTests2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxParseTests2_es5.2.minified.js index 3cd05d5f9f2..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxParseTests2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxParseTests2_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null); diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.2.minified.js index dc9e83192af..2d964335161 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es2015.2.minified.js @@ -1,7 +1,8 @@ -const React = require("react"), ReactRouter = require("react-router"); -var M, Route = ReactRouter.Route; -React.createElement(Route, null), function(M1) { +var M; +require("react"); +const ReactRouter = require("react-router"); +ReactRouter.Route, function(M1) { var X; M1.X = X; -}(M || (M = {})), M || (M = {}), React.createElement(X, null); +}(M || (M = {})), M || (M = {}), X; export { }; diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.2.minified.js index 7a3dcf4ec00..6964a1068bf 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit1_es5.2.minified.js @@ -1,6 +1,6 @@ -var M, React = require("react"), Route = require("react-router").Route; -React.createElement(Route, null), function(M1) { +var M; +require("react"), require("react-router").Route, function(M1) { var X; M1.X = X; -}(M || (M = {})), M || (M = {}), React.createElement(X, null); +}(M || (M = {})), M || (M = {}), X; export { }; diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxPreserveEmit2_es2015.2.minified.js index a4f6065408f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit2_es2015.2.minified.js @@ -1,2 +0,0 @@ -var Route; -React.createElement(Route, null); diff --git a/crates/swc/tests/tsc-references/tsxPreserveEmit2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxPreserveEmit2_es5.2.minified.js index a4f6065408f..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxPreserveEmit2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxPreserveEmit2_es5.2.minified.js @@ -1,2 +0,0 @@ -var Route; -React.createElement(Route, null); diff --git a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter1_es2015.2.minified.js index 8fb11ee0d60..836e70e2bec 100644 --- a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter1_es2015.2.minified.js @@ -1,6 +1,2 @@ -const React = require("react"); -React.createElement(MyComp, { - a: 10, - b: "hi" -}); +require("react"), MyComp; export { }; diff --git a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter1_es5.2.minified.js index 8168f67f374..836e70e2bec 100644 --- a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter1_es5.2.minified.js @@ -1,5 +1,2 @@ -require("react").createElement(MyComp, { - a: 10, - b: "hi" -}); +require("react"), MyComp; export { }; diff --git a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter2_es2015.2.minified.js index 9ba0c89038b..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter2_es2015.2.minified.js @@ -1,5 +1,2 @@ -const React = require("react"); -React.createElement(MyComp, null), React.createElement(MyComp, { - a: "hi" -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter2_es5.2.minified.js index 24cf515eb3e..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter2_es5.2.minified.js @@ -1,5 +1,2 @@ -var React = require("react"); -React.createElement(MyComp, null), React.createElement(MyComp, { - a: "hi" -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter3_es2015.2.minified.js index 33ad61490fb..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter3_es2015.2.minified.js @@ -1,8 +1,2 @@ -const React = require("react"); -React.createElement(MyComp, null), React.createElement(MyComp, { - a: 10, - b: "hi" -}), React.createElement(MyComp, { - a: "hi" -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter3_es5.2.minified.js index e98cabb30fd..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactComponentWithDefaultTypeParameter3_es5.2.minified.js @@ -1,8 +1,2 @@ -var React = require("react"); -React.createElement(MyComp, null), React.createElement(MyComp, { - a: 10, - b: "hi" -}), React.createElement(MyComp, { - a: "hi" -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxReactEmit1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit1_es2015.2.minified.js index 8609277e54b..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit1_es2015.2.minified.js @@ -1,28 +0,0 @@ -var p; -React.createElement("div", null), React.createElement("div", { - x: "1" -}), React.createElement("div", { - x: "1" -}), React.createElement("div", { - x: "1", - y: "0" -}), React.createElement("div", { - x: 0, - y: "0" -}), React.createElement("div", { - x: "1", - y: "0" -}), React.createElement("div", { - x: p, - y: "p", - b: !0 -}), React.createElement("div", null), React.createElement("div", { - n: "m" -}, "foo"), React.createElement("div", { - n: "m" -}, p), React.createElement("div", { - n: "m" -}, !1), React.createElement("div", { - n: "m", - b: !0 -}, !1), React.createElement("div", null, " "), React.createElement("div", null, " ", p, " "), React.createElement("div", null, p); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit1_es5.2.minified.js index 93013b6b095..eab76685307 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit1_es5.2.minified.js @@ -1,61 +1,18 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("div", null), React.createElement("div", { - x: "1" -}), React.createElement("div", { - x: "1" -}), React.createElement("div", { - x: "1", - y: "0" -}), React.createElement("div", { - x: 0, - y: "0" -}), React.createElement("div", { - x: "1", - y: "0" -}), React.createElement("div", { - x: p, - y: "p", - b: !0 -}), React.createElement("div", null), React.createElement("div", { - n: "m" -}, "foo"), React.createElement("div", { - n: "m" -}, p), React.createElement("div", { - n: "m" -}, !1), React.createElement("div", { - n: "m", - b: !0 -}, !1); var p, SomeClass = function() { "use strict"; function SomeClass() { swcHelpers.classCallCheck(this, SomeClass); } return SomeClass.prototype.f = function() { - var _this = this; - React.createElement("div", null, function() { - return _this; - }), React.createElement("div", null, [ + [ p ].concat(swcHelpers.toConsumableArray(p), [ p - ])), React.createElement("div", null, { - p: p - }), React.createElement("div", { - a: function() { - return _this; - } - }), React.createElement("div", { - a: [ - p - ].concat(swcHelpers.toConsumableArray(p), [ - p - ]) - }), React.createElement("div", { - a: { - p: p - } - }); + ]), [ + p + ].concat(swcHelpers.toConsumableArray(p), [ + p + ]); }, SomeClass; }(); -React.createElement("div", null, " "), React.createElement("div", null, " ", p, " "), React.createElement("div", null, p); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit2_es2015.2.minified.js index 70e287441d7..64ff0e17b16 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit2_es2015.2.minified.js @@ -1,11 +1,11 @@ var p1, p2, p3; import * as swcHelpers from "@swc/helpers"; -React.createElement("div", swcHelpers.extends({}, p1), p2), React.createElement("div", swcHelpers.extends({}, p1), p2), React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({}, p1), swcHelpers.extends({}, p1), swcHelpers.extends({ x: p3 -}, p1), p2), React.createElement("div", swcHelpers.extends({}, p1, { +}, p1), swcHelpers.extends({}, p1, { x: p3 -}), p2), React.createElement("div", swcHelpers.extends({ +}), swcHelpers.extends({ x: p2 }, p1, { y: p3 -}), p2); +}); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit2_es5.2.minified.js index 70e287441d7..64ff0e17b16 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit2_es5.2.minified.js @@ -1,11 +1,11 @@ var p1, p2, p3; import * as swcHelpers from "@swc/helpers"; -React.createElement("div", swcHelpers.extends({}, p1), p2), React.createElement("div", swcHelpers.extends({}, p1), p2), React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({}, p1), swcHelpers.extends({}, p1), swcHelpers.extends({ x: p3 -}, p1), p2), React.createElement("div", swcHelpers.extends({}, p1, { +}, p1), swcHelpers.extends({}, p1, { x: p3 -}), p2), React.createElement("div", swcHelpers.extends({ +}), swcHelpers.extends({ x: p2 }, p1, { y: p3 -}), p2); +}); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit3_es2015.2.minified.js index a258516ec69..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit3_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement(Foo, null, " ", React.createElement(Bar, null, " q "), " ", React.createElement(Bar, null), " s ", React.createElement(Bar, null), React.createElement(Bar, null)); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit3_es5.2.minified.js index a258516ec69..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit3_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement(Foo, null, " ", React.createElement(Bar, null, " q "), " ", React.createElement(Bar, null), " s ", React.createElement(Bar, null), React.createElement(Bar, null)); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit4_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit4_es2015.2.minified.js index e519a5f3176..5c8714c4d11 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit4_es2015.2.minified.js @@ -1,5 +1,5 @@ var p; import * as swcHelpers from "@swc/helpers"; -React.createElement("div", null, blah), React.createElement("div", swcHelpers.extends({}, p, { +blah, swcHelpers.extends({}, p, { x: 0 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit4_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit4_es5.2.minified.js index e519a5f3176..5c8714c4d11 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit4_es5.2.minified.js @@ -1,5 +1,5 @@ var p; import * as swcHelpers from "@swc/helpers"; -React.createElement("div", null, blah), React.createElement("div", swcHelpers.extends({}, p, { +blah, swcHelpers.extends({}, p, { x: 0 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.2.minified.js index 2648e434233..c5a1d876ad6 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit5_es2015.2.minified.js @@ -1,8 +1,8 @@ -var React, foo; +var foo; import * as swcHelpers from "@swc/helpers"; import { React } from "./test"; -React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({ x: "" }, foo, { y: "" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit5_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit5_es5.2.minified.js index 2648e434233..c5a1d876ad6 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit5_es5.2.minified.js @@ -1,8 +1,8 @@ -var React, foo; +var foo; import * as swcHelpers from "@swc/helpers"; import { React } from "./test"; -React.createElement("div", swcHelpers.extends({ +swcHelpers.extends({ x: "" }, foo, { y: "" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit6_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit6_es2015.2.minified.js index 5f8e735368f..e4e95b7d7a9 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit6_es2015.2.minified.js @@ -5,9 +5,9 @@ import * as swcHelpers from "@swc/helpers"; M1.React = React; }(M || (M = {})), function(M) { var foo; - React.createElement("div", swcHelpers.extends({ + swcHelpers.extends({ x: "" }, foo, { y: "" - })), React.createElement("div", null, "This \"quote\" thing"); + }); }(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit6_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit6_es5.2.minified.js index 5f8e735368f..e4e95b7d7a9 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit6_es5.2.minified.js @@ -5,9 +5,9 @@ import * as swcHelpers from "@swc/helpers"; M1.React = React; }(M || (M = {})), function(M) { var foo; - React.createElement("div", swcHelpers.extends({ + swcHelpers.extends({ x: "" }, foo, { y: "" - })), React.createElement("div", null, "This \"quote\" thing"); + }); }(M || (M = {})); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit7_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit7_es2015.2.minified.js index 2f2451e121d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit7_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit7_es2015.2.minified.js @@ -1,19 +0,0 @@ -React.createElement("div", { - "x-y": "val" -}), React.createElement("div", { - "xx-y": "val" -}), React.createElement("div", { - "x-yy": "val" -}), React.createElement("div", { - "xx-yy": "val" -}), React.createElement("div", { - x: "val" -}), React.createElement("div", { - xx: "val" -}), React.createElement("div", { - xxx: "val" -}), React.createElement("div", { - xxxx: "val" -}), React.createElement("div", { - xxxxx: "val" -}); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit7_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit7_es5.2.minified.js index 2f2451e121d..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit7_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit7_es5.2.minified.js @@ -1,19 +0,0 @@ -React.createElement("div", { - "x-y": "val" -}), React.createElement("div", { - "xx-y": "val" -}), React.createElement("div", { - "x-yy": "val" -}), React.createElement("div", { - "xx-yy": "val" -}), React.createElement("div", { - x: "val" -}), React.createElement("div", { - xx: "val" -}), React.createElement("div", { - xxx: "val" -}), React.createElement("div", { - xxxx: "val" -}), React.createElement("div", { - xxxxx: "val" -}); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit8_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit8_es2015.2.minified.js index a71c5b22edb..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit8_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit8_es2015.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("div", null, "1"), React.createElement("div", { - key: "key-attr" -}, "2"); diff --git a/crates/swc/tests/tsc-references/tsxReactEmit8_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmit8_es5.2.minified.js index a71c5b22edb..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmit8_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmit8_es5.2.minified.js @@ -1,3 +0,0 @@ -React.createElement("div", null, "1"), React.createElement("div", { - key: "key-attr" -}, "2"); diff --git a/crates/swc/tests/tsc-references/tsxReactEmitEntities_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmitEntities_es2015.2.minified.js index 1030a063d79..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmitEntities_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmitEntities_es2015.2.minified.js @@ -1,7 +0,0 @@ -React.createElement("div", null, "Dot goes here: \xb7 ¬AnEntity; "), React.createElement("div", null, "Be careful of \"-ed strings!"), React.createElement("div", null, "{{braces}}"), React.createElement("div", null, "\\n"), React.createElement("div", { - attr: "{…}\\" -}), React.createElement("div", { - attr: "{…}\"" -}), React.createElement("div", { - attr: "\"" -}), React.createElement("div", null, "🐈🐕🐇🐑"); diff --git a/crates/swc/tests/tsc-references/tsxReactEmitEntities_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmitEntities_es5.2.minified.js index 1030a063d79..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmitEntities_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmitEntities_es5.2.minified.js @@ -1,7 +0,0 @@ -React.createElement("div", null, "Dot goes here: \xb7 ¬AnEntity; "), React.createElement("div", null, "Be careful of \"-ed strings!"), React.createElement("div", null, "{{braces}}"), React.createElement("div", null, "\\n"), React.createElement("div", { - attr: "{…}\\" -}), React.createElement("div", { - attr: "{…}\"" -}), React.createElement("div", { - attr: "\"" -}), React.createElement("div", null, "🐈🐕🐇🐑"); diff --git a/crates/swc/tests/tsc-references/tsxReactEmitWhitespace2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmitWhitespace2_es2015.2.minified.js index 17394eec654..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmitWhitespace2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmitWhitespace2_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null, "word ", React.createElement("code", null, "code"), " word"), React.createElement("div", null, React.createElement("code", null, "code"), " word"), React.createElement("div", null, React.createElement("code", null), " word"); diff --git a/crates/swc/tests/tsc-references/tsxReactEmitWhitespace2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmitWhitespace2_es5.2.minified.js index 17394eec654..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmitWhitespace2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmitWhitespace2_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null, "word ", React.createElement("code", null, "code"), " word"), React.createElement("div", null, React.createElement("code", null, "code"), " word"), React.createElement("div", null, React.createElement("code", null), " word"); diff --git a/crates/swc/tests/tsc-references/tsxReactEmitWhitespace_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmitWhitespace_es2015.2.minified.js index 61f883008a2..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmitWhitespace_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmitWhitespace_es2015.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null, " "), React.createElement("div", null, " ", 0, " "), React.createElement("div", null, 0), React.createElement("div", null, 0), React.createElement("div", null, " 3"), React.createElement("div", null, " 3 "), React.createElement("div", null, "3"), React.createElement("div", null), React.createElement("div", null, "foo bar"), React.createElement("div", null, "hello\\ world"), React.createElement("div", null, " a b c d "); diff --git a/crates/swc/tests/tsc-references/tsxReactEmitWhitespace_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxReactEmitWhitespace_es5.2.minified.js index 61f883008a2..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxReactEmitWhitespace_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxReactEmitWhitespace_es5.2.minified.js @@ -1 +0,0 @@ -React.createElement("div", null, " "), React.createElement("div", null, " ", 0, " "), React.createElement("div", null, 0), React.createElement("div", null, 0), React.createElement("div", null, " 3"), React.createElement("div", null, " 3 "), React.createElement("div", null, "3"), React.createElement("div", null), React.createElement("div", null, "foo bar"), React.createElement("div", null, "hello\\ world"), React.createElement("div", null, " a b c d "); diff --git a/crates/swc/tests/tsc-references/tsxSfcReturnNullStrictNullChecks_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSfcReturnNullStrictNullChecks_es2015.2.minified.js index e963b56452f..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxSfcReturnNullStrictNullChecks_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSfcReturnNullStrictNullChecks_es2015.2.minified.js @@ -1,6 +1,2 @@ -const React = require("react"); -React.createElement((props)=>null -, null), React.createElement(function(x) { - return null; -}, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxSfcReturnNullStrictNullChecks_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSfcReturnNullStrictNullChecks_es5.2.minified.js index 9d6d5694430..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxSfcReturnNullStrictNullChecks_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSfcReturnNullStrictNullChecks_es5.2.minified.js @@ -1,7 +1,2 @@ -var React = require("react"); -React.createElement(function(props) { - return null; -}, null), React.createElement(function(x) { - return null; -}, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxSfcReturnNull_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSfcReturnNull_es2015.2.minified.js index e963b56452f..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxSfcReturnNull_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSfcReturnNull_es2015.2.minified.js @@ -1,6 +1,2 @@ -const React = require("react"); -React.createElement((props)=>null -, null), React.createElement(function(x) { - return null; -}, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxSfcReturnNull_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSfcReturnNull_es5.2.minified.js index 9d6d5694430..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxSfcReturnNull_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSfcReturnNull_es5.2.minified.js @@ -1,7 +1,2 @@ -var React = require("react"); -React.createElement(function(props) { - return null; -}, null), React.createElement(function(x) { - return null; -}, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxSfcReturnUndefinedStrictNullChecks_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSfcReturnUndefinedStrictNullChecks_es2015.2.minified.js index f759948fa3a..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxSfcReturnUndefinedStrictNullChecks_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSfcReturnUndefinedStrictNullChecks_es2015.2.minified.js @@ -1,4 +1,2 @@ -const React = require("react"); -React.createElement((props)=>void 0 -, null), React.createElement(function(x) {}, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxSfcReturnUndefinedStrictNullChecks_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSfcReturnUndefinedStrictNullChecks_es5.2.minified.js index 9aa75cfacd8..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxSfcReturnUndefinedStrictNullChecks_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSfcReturnUndefinedStrictNullChecks_es5.2.minified.js @@ -1,3 +1,2 @@ -var React = require("react"); -React.createElement(function(props) {}, null), React.createElement(function(x) {}, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution10_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution10_es2015.2.minified.js index cfc9af2f8b4..6d28d271f94 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution10_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution10_es2015.2.minified.js @@ -8,12 +8,10 @@ class Opt extends React.Component { const obj1 = { x: 2 }; -React.createElement(Opt, swcHelpers.extends({}, {}, { +swcHelpers.extends({}, {}, { x: 3 -})), React.createElement(Opt, swcHelpers.extends({}, obj1, { +}), swcHelpers.extends({}, obj1, { x: "Hi" -})), React.createElement(Opt, swcHelpers.extends({}, obj1, { +}), swcHelpers.extends({}, obj1, { x: 3 -})), React.createElement(Opt, { - x: !0 }); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution10_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution10_es5.2.minified.js index 3b67da28d5f..6d188f71ca4 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution10_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution10_es5.2.minified.js @@ -12,12 +12,10 @@ var React = require("react"), Opt = function(_Component) { }(React.Component), obj1 = { x: 2 }; -React.createElement(Opt, swcHelpers.extends({}, {}, { +swcHelpers.extends({}, {}, { x: 3 -})), React.createElement(Opt, swcHelpers.extends({}, obj1, { +}), swcHelpers.extends({}, obj1, { x: "Hi" -})), React.createElement(Opt, swcHelpers.extends({}, obj1, { +}), swcHelpers.extends({}, obj1, { x: 3 -})), React.createElement(Opt, { - x: !0 }); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution11_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution11_es2015.2.minified.js index 910ba53b156..b920375a170 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution11_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution11_es2015.2.minified.js @@ -8,18 +8,18 @@ class OverWriteAttr extends React.Component { } } let anyobj; -React.createElement(OverWriteAttr, swcHelpers.extends({}, {}, { +swcHelpers.extends({}, {}, { y: !0, overwrite: "hi" -}, obj1)), React.createElement(OverWriteAttr, swcHelpers.extends({}, obj1, { +}, obj1), swcHelpers.extends({}, obj1, { y: !0, overwrite: "hi" -})), React.createElement(OverWriteAttr, swcHelpers.extends({ +}), swcHelpers.extends({ x: 3, overwrite: "hi" }, obj1, { y: !0 -})), React.createElement(OverWriteAttr, swcHelpers.extends({ +}), swcHelpers.extends({ overwrite: "hi" }, obj1, { x: 3 @@ -27,10 +27,10 @@ React.createElement(OverWriteAttr, swcHelpers.extends({}, {}, { y: !0, x: 2, overwrite: "world" -})), React.createElement(OverWriteAttr, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: 2 }, { overwrite: "world" }, { y: !0 -})), React.createElement(OverWriteAttr, swcHelpers.extends({}, anyobj)); +}), swcHelpers.extends({}, anyobj); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution11_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution11_es5.2.minified.js index a21dafc1c5c..beae2f930c4 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution11_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution11_es5.2.minified.js @@ -12,18 +12,18 @@ var anyobj, React = require("react"), obj1 = { return React.createElement("div", null, "Hello"); }, OverWriteAttr; }(React.Component); -React.createElement(OverWriteAttr, swcHelpers.extends({}, {}, { +swcHelpers.extends({}, {}, { y: !0, overwrite: "hi" -}, obj1)), React.createElement(OverWriteAttr, swcHelpers.extends({}, obj1, { +}, obj1), swcHelpers.extends({}, obj1, { y: !0, overwrite: "hi" -})), React.createElement(OverWriteAttr, swcHelpers.extends({ +}), swcHelpers.extends({ x: 3, overwrite: "hi" }, obj1, { y: !0 -})), React.createElement(OverWriteAttr, swcHelpers.extends({ +}), swcHelpers.extends({ overwrite: "hi" }, obj1, { x: 3 @@ -31,10 +31,10 @@ React.createElement(OverWriteAttr, swcHelpers.extends({}, {}, { y: !0, x: 2, overwrite: "world" -})), React.createElement(OverWriteAttr, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: 2 }, { overwrite: "world" }, { y: !0 -})), React.createElement(OverWriteAttr, swcHelpers.extends({}, anyobj)); +}), swcHelpers.extends({}, anyobj); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution12_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution12_es2015.2.minified.js index dae2deb5ba4..bd2f20cb2dc 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution12_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution12_es2015.2.minified.js @@ -8,19 +8,19 @@ class OverWriteAttr extends React.Component { } } let anyobj; -React.createElement(OverWriteAttr, swcHelpers.extends({}, {}, { +swcHelpers.extends({}, {}, { y: !0, overwrite: "hi" -}, obj1)), React.createElement(OverWriteAttr, swcHelpers.extends({ +}, obj1), swcHelpers.extends({ overwrite: "hi" }, obj1, { x: 3 }, { y: !0 -})), React.createElement(OverWriteAttr, swcHelpers.extends({}, anyobj, { +}), swcHelpers.extends({}, anyobj, { x: 3 -})), React.createElement(OverWriteAttr, swcHelpers.extends({ +}), swcHelpers.extends({ overwrite: "hi" }, obj1, { y: !0 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution12_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution12_es5.2.minified.js index 553bca60389..ba35b923694 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution12_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution12_es5.2.minified.js @@ -12,19 +12,19 @@ var anyobj, React = require("react"), obj1 = { return React.createElement("div", null, "Hello"); }, OverWriteAttr; }(React.Component); -React.createElement(OverWriteAttr, swcHelpers.extends({}, {}, { +swcHelpers.extends({}, {}, { y: !0, overwrite: "hi" -}, obj1)), React.createElement(OverWriteAttr, swcHelpers.extends({ +}, obj1), swcHelpers.extends({ overwrite: "hi" }, obj1, { x: 3 }, { y: !0 -})), React.createElement(OverWriteAttr, swcHelpers.extends({}, anyobj, { +}), swcHelpers.extends({}, anyobj, { x: 3 -})), React.createElement(OverWriteAttr, swcHelpers.extends({ +}), swcHelpers.extends({ overwrite: "hi" }, obj1, { y: !0 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17_es2015.2.minified.js index 9c337de09fc..ebe3259d90f 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17_es2015.2.minified.js @@ -4,4 +4,4 @@ export class Empty extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Empty, swcHelpers.extends({}, obj)); +swcHelpers.extends({}, obj); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17_es5.2.minified.js index bfd0294308e..8931cd89de8 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution17_es5.2.minified.js @@ -10,4 +10,4 @@ export var Empty = function(_Component) { return React.createElement("div", null, "Hello"); }, Empty; }(React.Component); -React.createElement(Empty, swcHelpers.extends({}, obj)); +swcHelpers.extends({}, obj); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution1_es2015.2.minified.js index 20c8d499634..9cd9cbb71ef 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution1_es2015.2.minified.js @@ -5,4 +5,4 @@ class Poisoned extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Poisoned, swcHelpers.extends({}, {})), React.createElement(Poisoned, null); +swcHelpers.extends({}, {}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution1_es5.2.minified.js index 9450a7c36c5..4fdcd1f94d9 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution1_es5.2.minified.js @@ -10,4 +10,4 @@ var React = require("react"), Poisoned = function(_Component) { return React.createElement("div", null, "Hello"); }, Poisoned; }(React.Component); -React.createElement(Poisoned, swcHelpers.extends({}, {})), React.createElement(Poisoned, null); +swcHelpers.extends({}, {}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution2_es2015.2.minified.js index 0696ffffb68..50cc0a81877 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution2_es2015.2.minified.js @@ -5,18 +5,15 @@ class Poisoned extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Poisoned, swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "ok", y: "2" -})), React.createElement(Poisoned, swcHelpers.extends({}, {})), React.createElement(Poisoned, null), React.createElement(Poisoned, { - x: !0, - y: !0 -}), React.createElement(Poisoned, swcHelpers.extends({}, { +}), swcHelpers.extends({}, {}), swcHelpers.extends({}, { x: 5, y: "2" -})), React.createElement(Poisoned, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: 5, y: "2" }, { X: "hi" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution2_es5.2.minified.js index 56bdbb51906..2a89d2f590b 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution2_es5.2.minified.js @@ -10,18 +10,15 @@ var React = require("react"), Poisoned = function(_Component) { return React.createElement("div", null, "Hello"); }, Poisoned; }(React.Component); -React.createElement(Poisoned, swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "ok", y: "2" -})), React.createElement(Poisoned, swcHelpers.extends({}, {})), React.createElement(Poisoned, null), React.createElement(Poisoned, { - x: !0, - y: !0 -}), React.createElement(Poisoned, swcHelpers.extends({}, { +}), swcHelpers.extends({}, {}), swcHelpers.extends({}, { x: 5, y: "2" -})), React.createElement(Poisoned, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { x: 5, y: "2" }, { X: "hi" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution3_es2015.2.minified.js index cc1c1c14160..5a8ef414d49 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution3_es2015.2.minified.js @@ -5,10 +5,7 @@ class Poisoned extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Poisoned, swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "hello world", y: 2 -})), React.createElement(Poisoned, { - x: "hi", - y: 2 }); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution3_es5.2.minified.js index da595b28240..0de27499ec2 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution3_es5.2.minified.js @@ -10,10 +10,7 @@ var React = require("react"), Poisoned = function(_Component) { return React.createElement("div", null, "Hello"); }, Poisoned; }(React.Component); -React.createElement(Poisoned, swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "hello world", y: 2 -})), React.createElement(Poisoned, { - x: "hi", - y: 2 }); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution4_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution4_es2015.2.minified.js index f049a3fa12c..758a8fc38b8 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution4_es2015.2.minified.js @@ -5,22 +5,20 @@ class Poisoned extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Poisoned, swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "hello world", y: 2 -})); +}); class EmptyProp extends React.Component { render() { return React.createElement("div", null, "Default hi"); } } let j; -React.createElement(EmptyProp, swcHelpers.extends({}, {})), React.createElement(EmptyProp, swcHelpers.extends({}, j)), React.createElement(EmptyProp, swcHelpers.extends({}, { +swcHelpers.extends({}, {}), swcHelpers.extends({}, j), swcHelpers.extends({}, { ref: (input)=>{ this.textInput = input; } -})), React.createElement(EmptyProp, { +}), swcHelpers.extends({}, { "data-prop": !0 -}), React.createElement(EmptyProp, swcHelpers.extends({}, { - "data-prop": !0 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution4_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution4_es5.2.minified.js index d5ee5ca8fa5..14d36e2b66e 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution4_es5.2.minified.js @@ -10,10 +10,10 @@ var j, _this = this, React = require("react"), Poisoned = function(_Component) { return React.createElement("div", null, "Hello"); }, Poisoned; }(React.Component); -React.createElement(Poisoned, swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "hello world", y: 2 -})); +}); var EmptyProp = function(_Component) { "use strict"; swcHelpers.inherits(EmptyProp, _Component); @@ -25,12 +25,10 @@ var EmptyProp = function(_Component) { return React.createElement("div", null, "Default hi"); }, EmptyProp; }(React.Component); -React.createElement(EmptyProp, swcHelpers.extends({}, {})), React.createElement(EmptyProp, swcHelpers.extends({}, j)), React.createElement(EmptyProp, swcHelpers.extends({}, { +swcHelpers.extends({}, {}), swcHelpers.extends({}, j), swcHelpers.extends({}, { ref: function(input) { _this.textInput = input; } -})), React.createElement(EmptyProp, { +}), swcHelpers.extends({}, { "data-prop": !0 -}), React.createElement(EmptyProp, swcHelpers.extends({}, { - "data-prop": !0 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution5_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution5_es2015.2.minified.js index 3f7da16b96b..952e5a52d7c 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution5_es2015.2.minified.js @@ -5,15 +5,15 @@ class Poisoned extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(Poisoned, swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "hello world", y: 2 -})); +}); class EmptyProp extends React.Component { render() { return React.createElement("div", null, "Default hi"); } } -React.createElement(EmptyProp, swcHelpers.extends({}, { +swcHelpers.extends({}, { prop1: !1 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution5_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution5_es5.2.minified.js index a369f887fe9..0bc674f1682 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution5_es5.2.minified.js @@ -10,10 +10,10 @@ var React = require("react"), Poisoned = function(_Component) { return React.createElement("div", null, "Hello"); }, Poisoned; }(React.Component); -React.createElement(Poisoned, swcHelpers.extends({}, { +swcHelpers.extends({}, { x: "hello world", y: 2 -})); +}); var EmptyProp = function(_Component) { "use strict"; swcHelpers.inherits(EmptyProp, _Component); @@ -25,6 +25,6 @@ var EmptyProp = function(_Component) { return React.createElement("div", null, "Default hi"); }, EmptyProp; }(React.Component); -React.createElement(EmptyProp, swcHelpers.extends({}, { +swcHelpers.extends({}, { prop1: !1 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution6_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution6_es2015.2.minified.js index a962c2aa9ad..00faee0a557 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution6_es2015.2.minified.js @@ -4,7 +4,4 @@ class TextComponent extends React.Component { return React.createElement("span", null, "Some Text.."); } } -React.createElement(TextComponent, { - editable: !0 -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution6_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution6_es5.2.minified.js index 2a897a87362..af1d4b28d79 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution6_es5.2.minified.js @@ -10,6 +10,3 @@ var React = require("react"), TextComponent = function(_Component) { return React.createElement("span", null, "Some Text.."); }, TextComponent; }(React.Component); -React.createElement(TextComponent, { - editable: !0 -}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution7_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution7_es2015.2.minified.js index df1b52a8e47..2c382711ba6 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution7_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution7_es2015.2.minified.js @@ -5,9 +5,9 @@ class TextComponent extends React.Component { return React.createElement("span", null, "Some Text.."); } } -React.createElement(TextComponent, swcHelpers.extends({}, { +swcHelpers.extends({}, { editable: !1 -})), React.createElement(TextComponent, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { editable: !0, onEdit: ()=>{} -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution7_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution7_es5.2.minified.js index 4e66b305ee9..539b5b354d6 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution7_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution7_es5.2.minified.js @@ -10,9 +10,9 @@ var React = require("react"), TextComponent = function(_Component) { return React.createElement("span", null, "Some Text.."); }, TextComponent; }(React.Component); -React.createElement(TextComponent, swcHelpers.extends({}, { +swcHelpers.extends({}, { editable: !1 -})), React.createElement(TextComponent, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { editable: !0, onEdit: function() {} -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution8_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution8_es2015.2.minified.js index 6eb1f44634f..3554e26c35a 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution8_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution8_es2015.2.minified.js @@ -7,10 +7,10 @@ class OverWriteAttr extends React.Component { return React.createElement("div", null, "Hello"); } } -React.createElement(OverWriteAttr, swcHelpers.extends({}, {}, { +swcHelpers.extends({}, {}, { y: !0, overwrite: "hi" -}, obj1)), React.createElement(OverWriteAttr, swcHelpers.extends({}, obj1, { +}, obj1), swcHelpers.extends({}, obj1, { y: !0, overwrite: "hi" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution8_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution8_es5.2.minified.js index b0e9ed8752e..1ee6efe7770 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution8_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution8_es5.2.minified.js @@ -12,10 +12,10 @@ var React = require("react"), obj1 = { return React.createElement("div", null, "Hello"); }, OverWriteAttr; }(React.Component); -React.createElement(OverWriteAttr, swcHelpers.extends({}, {}, { +swcHelpers.extends({}, {}, { y: !0, overwrite: "hi" -}, obj1)), React.createElement(OverWriteAttr, swcHelpers.extends({}, obj1, { +}, obj1), swcHelpers.extends({}, obj1, { y: !0, overwrite: "hi" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution9_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution9_es2015.2.minified.js index 8f4de1ff88f..a903d715611 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution9_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution9_es2015.2.minified.js @@ -8,8 +8,6 @@ class Opt extends React.Component { const obj1 = { x: 2 }; -React.createElement(Opt, null), React.createElement(Opt, swcHelpers.extends({}, {})), React.createElement(Opt, swcHelpers.extends({}, obj1)), React.createElement(Opt, swcHelpers.extends({}, obj1, { +swcHelpers.extends({}, {}), swcHelpers.extends({}, obj1), swcHelpers.extends({}, obj1, { y: !0 -})), React.createElement(Opt, { - x: 2 }); diff --git a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution9_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution9_es5.2.minified.js index 93d45ac295c..990dd6f6907 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution9_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadAttributesResolution9_es5.2.minified.js @@ -12,8 +12,6 @@ var React = require("react"), Opt = function(_Component) { }(React.Component), obj1 = { x: 2 }; -React.createElement(Opt, null), React.createElement(Opt, swcHelpers.extends({}, {})), React.createElement(Opt, swcHelpers.extends({}, obj1)), React.createElement(Opt, swcHelpers.extends({}, obj1, { +swcHelpers.extends({}, {}), swcHelpers.extends({}, obj1), swcHelpers.extends({}, obj1, { y: !0 -})), React.createElement(Opt, { - x: 2 }); diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.2.minified.js index 487bfc3f51c..549d5d5c671 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es2015.2.minified.js @@ -1,5 +1,3 @@ import * as swcHelpers from "@swc/helpers"; let x; -React.createElement(function({ todos }) { - return React.createElement("div", null); -}, swcHelpers.extends({}, x)); +swcHelpers.extends({}, x); diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.2.minified.js index 66008254d3d..809de5a2b54 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType_es5.2.minified.js @@ -1,5 +1,3 @@ var x; import * as swcHelpers from "@swc/helpers"; -React.createElement(function(param) { - return param.todos, React.createElement("div", null); -}, swcHelpers.extends({}, x)); +swcHelpers.extends({}, x); diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.2.minified.js index 487bfc3f51c..549d5d5c671 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildren_es2015.2.minified.js @@ -1,5 +1,3 @@ import * as swcHelpers from "@swc/helpers"; let x; -React.createElement(function({ todos }) { - return React.createElement("div", null); -}, swcHelpers.extends({}, x)); +swcHelpers.extends({}, x); diff --git a/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.2.minified.js index 66008254d3d..809de5a2b54 100644 --- a/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxSpreadChildren_es5.2.minified.js @@ -1,5 +1,3 @@ var x; import * as swcHelpers from "@swc/helpers"; -React.createElement(function(param) { - return param.todos, React.createElement("div", null); -}, swcHelpers.extends({}, x)); +swcHelpers.extends({}, x); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1_es2015.2.minified.js index 12485c59152..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1_es2015.2.minified.js @@ -1,48 +1,2 @@ -const React = require("react"); -React.createElement(OneThing, { - yxx: "ok" -}), React.createElement(OneThing, { - yy: 100, - yy1: "hello" -}), React.createElement(OneThing, { - yxx: "hello", - "ignore-prop": !0 -}), React.createElement(OneThing, { - data: "hello", - "data-prop": !0 -}), React.createElement(OneThing, { - yxx1: "ok" -}, "Hello"), React.createElement(TestingOneThing, { - y1: !0, - "extra-data": !0 -}), React.createElement(TestingOneThing, { - "extra-data": "hello" -}), React.createElement(TestingOneThing, { - "extra-data": "hello", - yy: "hihi" -}), React.createElement(TestingOneThing, { - "extra-data": "hello", - yy: 9, - direction: 10 -}), React.createElement(TestingOneThing, { - "extra-data": "hello", - yy: "hello", - name: "Bob" -}), React.createElement(TestingOptional, null), React.createElement(TestingOptional, { - y1: "hello" -}), React.createElement(TestingOptional, { - y1: "hello", - y2: 1000 -}), React.createElement(TestingOptional, { - y1: !0, - y3: !0 -}), React.createElement(TestingOptional, { - y1: !0, - y3: !0, - y2: 10 -}), React.createElement(TestingOptional, { - y1: !0, - y3: !0, - "extra-prop": !0 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1_es5.2.minified.js index 09697a87e59..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload1_es5.2.minified.js @@ -1,48 +1,2 @@ -var React = require("react"); -React.createElement(OneThing, { - yxx: "ok" -}), React.createElement(OneThing, { - yy: 100, - yy1: "hello" -}), React.createElement(OneThing, { - yxx: "hello", - "ignore-prop": !0 -}), React.createElement(OneThing, { - data: "hello", - "data-prop": !0 -}), React.createElement(OneThing, { - yxx1: "ok" -}, "Hello"), React.createElement(TestingOneThing, { - y1: !0, - "extra-data": !0 -}), React.createElement(TestingOneThing, { - "extra-data": "hello" -}), React.createElement(TestingOneThing, { - "extra-data": "hello", - yy: "hihi" -}), React.createElement(TestingOneThing, { - "extra-data": "hello", - yy: 9, - direction: 10 -}), React.createElement(TestingOneThing, { - "extra-data": "hello", - yy: "hello", - name: "Bob" -}), React.createElement(TestingOptional, null), React.createElement(TestingOptional, { - y1: "hello" -}), React.createElement(TestingOptional, { - y1: "hello", - y2: 1000 -}), React.createElement(TestingOptional, { - y1: !0, - y3: !0 -}), React.createElement(TestingOptional, { - y1: !0, - y3: !0, - y2: 10 -}), React.createElement(TestingOptional, { - y1: !0, - y3: !0, - "extra-prop": !0 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2_es2015.2.minified.js index f9389846a16..ee32ae128fd 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2_es2015.2.minified.js @@ -1,27 +1,25 @@ import * as swcHelpers from "@swc/helpers"; -const React = require("react"); +require("react"); let obj = { yy: 10, yy1: "hello" }, obj1 = { yy: !0 }, defaultObj; -React.createElement(OneThing, null), React.createElement(OneThing, swcHelpers.extends({}, obj)), React.createElement(OneThing, swcHelpers.extends({}, {})), React.createElement(OneThing, swcHelpers.extends({}, obj1, obj)), React.createElement(OneThing, swcHelpers.extends({}, obj1, { +OneThing, OneThing, swcHelpers.extends({}, obj), OneThing, swcHelpers.extends({}, {}), OneThing, swcHelpers.extends({}, obj1, obj), OneThing, swcHelpers.extends({}, obj1, { yy: 42 }, { yy1: "hi" -})), React.createElement(OneThing, swcHelpers.extends({}, obj1, { +}), OneThing, swcHelpers.extends({}, obj1, { yy: 10000, yy1: "true" -})), React.createElement(OneThing, swcHelpers.extends({}, defaultObj, { +}), OneThing, swcHelpers.extends({}, defaultObj, { yy: !0 -}, obj)), React.createElement(OneThing, { - "ignore-prop": 100 -}), React.createElement(OneThing, swcHelpers.extends({}, { +}, obj), OneThing, OneThing, swcHelpers.extends({}, { "ignore-prop": 200 -})), React.createElement(OneThing, swcHelpers.extends({}, { +}), OneThing, swcHelpers.extends({}, { yy: 500, "ignore-prop": "hello" }, { yy1: "boo" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2_es5.2.minified.js index f59c659d191..18fbd98292a 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload2_es5.2.minified.js @@ -1,26 +1,25 @@ import * as swcHelpers from "@swc/helpers"; -var defaultObj, React = require("react"), obj = { +require("react"); +var defaultObj, obj = { yy: 10, yy1: "hello" }, obj1 = { yy: !0 }; -React.createElement(OneThing, null), React.createElement(OneThing, swcHelpers.extends({}, obj)), React.createElement(OneThing, swcHelpers.extends({}, {})), React.createElement(OneThing, swcHelpers.extends({}, obj1, obj)), React.createElement(OneThing, swcHelpers.extends({}, obj1, { +OneThing, OneThing, swcHelpers.extends({}, obj), OneThing, swcHelpers.extends({}, {}), OneThing, swcHelpers.extends({}, obj1, obj), OneThing, swcHelpers.extends({}, obj1, { yy: 42 }, { yy1: "hi" -})), React.createElement(OneThing, swcHelpers.extends({}, obj1, { +}), OneThing, swcHelpers.extends({}, obj1, { yy: 10000, yy1: "true" -})), React.createElement(OneThing, swcHelpers.extends({}, defaultObj, { +}), OneThing, swcHelpers.extends({}, defaultObj, { yy: !0 -}, obj)), React.createElement(OneThing, { - "ignore-prop": 100 -}), React.createElement(OneThing, swcHelpers.extends({}, { +}, obj), OneThing, OneThing, swcHelpers.extends({}, { "ignore-prop": 200 -})), React.createElement(OneThing, swcHelpers.extends({}, { +}), OneThing, swcHelpers.extends({}, { yy: 500, "ignore-prop": "hello" }, { yy1: "boo" -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3_es2015.2.minified.js index 952e540b73c..d2724921900 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3_es2015.2.minified.js @@ -1,17 +1,9 @@ import * as swcHelpers from "@swc/helpers"; let obj2; -React.createElement(ZeroThingOrTwoThing, null), React.createElement(ZeroThingOrTwoThing, { - yy: 100, - yy1: "hello" -}), React.createElement(ZeroThingOrTwoThing, swcHelpers.extends({}, obj2)), React.createElement(ZeroThingOrTwoThing, swcHelpers.extends({ +ZeroThingOrTwoThing, ZeroThingOrTwoThing, ZeroThingOrTwoThing, swcHelpers.extends({}, obj2), ZeroThingOrTwoThing, swcHelpers.extends({ yy: 1000 -}, obj2)), React.createElement(ZeroThingOrTwoThing, swcHelpers.extends({}, obj2, { +}, obj2), ZeroThingOrTwoThing, swcHelpers.extends({}, obj2, { yy: 1000 -})), React.createElement(ThreeThing, { - yy: 99, - yy1: "hello world" -}), React.createElement(ThreeThing, { - y2: "Bye" -}), React.createElement(ThreeThing, swcHelpers.extends({}, obj2, { +}), ThreeThing, ThreeThing, ThreeThing, swcHelpers.extends({}, obj2, { y2: 10 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3_es5.2.minified.js index 8f52a31f2f5..491d7a3a03b 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload3_es5.2.minified.js @@ -1,17 +1,9 @@ var obj2; import * as swcHelpers from "@swc/helpers"; -React.createElement(ZeroThingOrTwoThing, null), React.createElement(ZeroThingOrTwoThing, { - yy: 100, - yy1: "hello" -}), React.createElement(ZeroThingOrTwoThing, swcHelpers.extends({}, obj2)), React.createElement(ZeroThingOrTwoThing, swcHelpers.extends({ +ZeroThingOrTwoThing, ZeroThingOrTwoThing, ZeroThingOrTwoThing, swcHelpers.extends({}, obj2), ZeroThingOrTwoThing, swcHelpers.extends({ yy: 1000 -}, obj2)), React.createElement(ZeroThingOrTwoThing, swcHelpers.extends({}, obj2, { +}, obj2), ZeroThingOrTwoThing, swcHelpers.extends({}, obj2, { yy: 1000 -})), React.createElement(ThreeThing, { - yy: 99, - yy1: "hello world" -}), React.createElement(ThreeThing, { - y2: "Bye" -}), React.createElement(ThreeThing, swcHelpers.extends({}, obj2, { +}), ThreeThing, ThreeThing, ThreeThing, swcHelpers.extends({}, obj2, { y2: 10 -})); +}); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4_es2015.2.minified.js index 0cc7df0b8bb..59c84ce14da 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4_es2015.2.minified.js @@ -1,42 +1,19 @@ import * as swcHelpers from "@swc/helpers"; -const React = require("react"); +require("react"); let obj = { yy: 10, yy1: "hello" }, obj2; -React.createElement(OneThing, { - extraProp: !0 -}), React.createElement(OneThing, { - yy: 10 -}), React.createElement(OneThing, swcHelpers.extends({}, obj, { +OneThing, OneThing, OneThing, swcHelpers.extends({}, obj, { yy1: !0 -})), React.createElement(OneThing, swcHelpers.extends({}, obj, { +}), OneThing, swcHelpers.extends({}, obj, { extra: "extra attr" -})), React.createElement(OneThing, swcHelpers.extends({}, obj, { +}), OneThing, swcHelpers.extends({}, obj, { y1: 10000 -})), React.createElement(OneThing, swcHelpers.extends({}, obj, { +}), OneThing, swcHelpers.extends({}, obj, { yy: !0 -})), React.createElement(OneThing, swcHelpers.extends({}, obj2, { +}), OneThing, swcHelpers.extends({}, obj2, { extra: "extra attr" -})), React.createElement(OneThing, swcHelpers.extends({}, obj2, { +}), OneThing, swcHelpers.extends({}, obj2, { yy: !0 -})), React.createElement(TestingOneThing, { - "extra-data": !0 -}), React.createElement(TestingOneThing, { - yy: "hello", - direction: "left" -}), React.createElement(TestingOptional, { - y1: !0, - y3: "hello" -}), React.createElement(TestingOptional, { - y1: "hello", - y2: 1000, - y3: !0 -}), React.createElement(TestingOptional, { - y1: "hello", - y2: 1000, - children: "hi" -}), React.createElement(TestingOptional, { - y1: "hello", - y2: 1000 -}, "Hi"); +}), TestingOneThing, TestingOneThing, TestingOptional, TestingOptional, TestingOptional, TestingOptional; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4_es5.2.minified.js index 925c70354cc..4c620311135 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload4_es5.2.minified.js @@ -1,41 +1,19 @@ import * as swcHelpers from "@swc/helpers"; -var obj2, React = require("react"), obj = { +require("react"); +var obj2, obj = { yy: 10, yy1: "hello" }; -React.createElement(OneThing, { - extraProp: !0 -}), React.createElement(OneThing, { - yy: 10 -}), React.createElement(OneThing, swcHelpers.extends({}, obj, { +OneThing, OneThing, OneThing, swcHelpers.extends({}, obj, { yy1: !0 -})), React.createElement(OneThing, swcHelpers.extends({}, obj, { +}), OneThing, swcHelpers.extends({}, obj, { extra: "extra attr" -})), React.createElement(OneThing, swcHelpers.extends({}, obj, { +}), OneThing, swcHelpers.extends({}, obj, { y1: 10000 -})), React.createElement(OneThing, swcHelpers.extends({}, obj, { +}), OneThing, swcHelpers.extends({}, obj, { yy: !0 -})), React.createElement(OneThing, swcHelpers.extends({}, obj2, { +}), OneThing, swcHelpers.extends({}, obj2, { extra: "extra attr" -})), React.createElement(OneThing, swcHelpers.extends({}, obj2, { +}), OneThing, swcHelpers.extends({}, obj2, { yy: !0 -})), React.createElement(TestingOneThing, { - "extra-data": !0 -}), React.createElement(TestingOneThing, { - yy: "hello", - direction: "left" -}), React.createElement(TestingOptional, { - y1: !0, - y3: "hello" -}), React.createElement(TestingOptional, { - y1: "hello", - y2: 1000, - y3: !0 -}), React.createElement(TestingOptional, { - y1: "hello", - y2: 1000, - children: "hi" -}), React.createElement(TestingOptional, { - y1: "hello", - y2: 1000 -}, "Hi"); +}), TestingOneThing, TestingOneThing, TestingOptional, TestingOptional, TestingOptional, TestingOptional; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload5_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload5_es2015.2.minified.js index cebb75a0a81..ab685448ce5 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload5_es2015.2.minified.js @@ -1,37 +1,32 @@ import * as swcHelpers from "@swc/helpers"; -const React = require("react"); +require("react"); let obj0 = { to: "world" }, obj3; export function MainButton(props) { return props.to ? this._buildMainLink(props) : this._buildMainButton(props); } -React.createElement(MainButton, { - to: "/some/path", +swcHelpers.extends({ onClick: (e)=>{} -}, "GO"), React.createElement(MainButton, swcHelpers.extends({ - onClick: (e)=>{} -}, obj0), "Hello world"), React.createElement(MainButton, swcHelpers.extends({}, { +}, obj0), swcHelpers.extends({}, { to: "10000" }, { onClick: ()=>{} -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { to: "10000" }, { onClick: (k)=>{} -})), React.createElement(MainButton, swcHelpers.extends({}, obj3, { +}), swcHelpers.extends({}, obj3, { to: !0 -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick (e) {} -}, obj0)), React.createElement(MainButton, swcHelpers.extends({}, { +}, obj0), swcHelpers.extends({}, { onClick (e) {} }, { children: 10 -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick (e) {} }, { children: "hello", className: !0 -})), React.createElement(MainButton, { - "data-format": !0 }); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload5_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload5_es5.2.minified.js index ac971c0bdb6..3ef1b397ea0 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload5_es5.2.minified.js @@ -1,36 +1,32 @@ import * as swcHelpers from "@swc/helpers"; -var obj3, React = require("react"), obj0 = { +require("react"); +var obj3, obj0 = { to: "world" }; export function MainButton(props) { return props.to ? this._buildMainLink(props) : this._buildMainButton(props); } -React.createElement(MainButton, { - to: "/some/path", +swcHelpers.extends({ onClick: function(e) {} -}, "GO"), React.createElement(MainButton, swcHelpers.extends({ - onClick: function(e) {} -}, obj0), "Hello world"), React.createElement(MainButton, swcHelpers.extends({}, { +}, obj0), swcHelpers.extends({}, { to: "10000" }, { onClick: function() {} -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { to: "10000" }, { onClick: function(k) {} -})), React.createElement(MainButton, swcHelpers.extends({}, obj3, { +}), swcHelpers.extends({}, obj3, { to: !0 -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick: function(e) {} -}, obj0)), React.createElement(MainButton, swcHelpers.extends({}, { +}, obj0), swcHelpers.extends({}, { onClick: function(e) {} }, { children: 10 -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick: function(e) {} }, { children: "hello", className: !0 -})), React.createElement(MainButton, { - "data-format": !0 }); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload6_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload6_es2015.2.minified.js index 628d8dd632b..d96ea56649a 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload6_es2015.2.minified.js @@ -1,5 +1,5 @@ import * as swcHelpers from "@swc/helpers"; -const React = require("react"); +require("react"); let obj = { children: "hi", to: "boo" @@ -7,32 +7,16 @@ let obj = { export function MainButton(props) { return props.to ? this._buildMainLink(props) : this._buildMainButton(props); } -React.createElement(MainButton, { - to: "/some/path" -}, "GO"), React.createElement(MainButton, { - onClick: (e)=>{} -}, "Hello world"), React.createElement(MainButton, swcHelpers.extends({}, obj)), React.createElement(MainButton, swcHelpers.extends({}, { +swcHelpers.extends({}, obj), swcHelpers.extends({}, { to: 10000 -}, obj)), React.createElement(MainButton, swcHelpers.extends({}, obj1)), React.createElement(MainButton, swcHelpers.extends({}, obj1, { +}, obj), swcHelpers.extends({}, obj1), swcHelpers.extends({}, obj1, { to: "/to/somewhere" -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick: ()=>{} -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick: ()=>{ console.log("hi"); } -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick () {} -})), React.createElement(MainButton, { - to: "/some/path", - "extra-prop": !0 -}, "GO"), React.createElement(MainButton, { - to: "/some/path", - children: "hi" -}), React.createElement(MainButton, { - onClick: (e)=>{}, - className: "hello", - "data-format": !0 -}, "Hello world"), React.createElement(MainButton, { - "data-format": "Hello world" -}); +}), (e)=>{}; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload6_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload6_es5.2.minified.js index 6887521e5e8..3dbf8524902 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentOverload6_es5.2.minified.js @@ -1,37 +1,22 @@ import * as swcHelpers from "@swc/helpers"; -var obj1, React = require("react"), obj = { +require("react"); +var obj1, obj = { children: "hi", to: "boo" }; export function MainButton(props) { return props.to ? this._buildMainLink(props) : this._buildMainButton(props); } -React.createElement(MainButton, { - to: "/some/path" -}, "GO"), React.createElement(MainButton, { - onClick: function(e) {} -}, "Hello world"), React.createElement(MainButton, swcHelpers.extends({}, obj)), React.createElement(MainButton, swcHelpers.extends({}, { +swcHelpers.extends({}, obj), swcHelpers.extends({}, { to: 10000 -}, obj)), React.createElement(MainButton, swcHelpers.extends({}, obj1)), React.createElement(MainButton, swcHelpers.extends({}, obj1, { +}, obj), swcHelpers.extends({}, obj1), swcHelpers.extends({}, obj1, { to: "/to/somewhere" -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick: function() {} -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick: function() { console.log("hi"); } -})), React.createElement(MainButton, swcHelpers.extends({}, { +}), swcHelpers.extends({}, { onClick: function() {} -})), React.createElement(MainButton, { - to: "/some/path", - "extra-prop": !0 -}, "GO"), React.createElement(MainButton, { - to: "/some/path", - children: "hi" -}), React.createElement(MainButton, { - onClick: function(e) {}, - className: "hello", - "data-format": !0 -}, "Hello world"), React.createElement(MainButton, { - "data-format": "Hello world" }); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter1_es2015.2.minified.js index f7dd4d5f1ed..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter1_es2015.2.minified.js @@ -1,10 +1,2 @@ -const React = require("react"); -function MyComponent(attr) { - return React.createElement("div", null, "attr.values"); -} -React.createElement(MyComponent, { - values: !0 -}), React.createElement(MyComponent, { - values: "Hello" -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter1_es5.2.minified.js index 0fc84397a51..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter1_es5.2.minified.js @@ -1,10 +1,2 @@ -var React = require("react"); -function MyComponent(attr) { - return React.createElement("div", null, "attr.values"); -} -React.createElement(MyComponent, { - values: !0 -}), React.createElement(MyComponent, { - values: "Hello" -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter2_es2015.2.minified.js index 3a0a0096d3d..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter2_es2015.2.minified.js @@ -1,7 +1,2 @@ -const React = require("react"); -React.createElement(function(attr) { - return React.createElement("div", null, "attr.values"); -}, { - values: 5 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter2_es5.2.minified.js index 7bcd111d48a..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentWithDefaultTypeParameter2_es5.2.minified.js @@ -1,7 +1,2 @@ -var React = require("react"); -React.createElement(function(attr) { - return React.createElement("div", null, "attr.values"); -}, { - values: 5 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents2_es2015.2.minified.js index f6da3941f55..1a178848bf5 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents2_es2015.2.minified.js @@ -1,27 +1,7 @@ const React = require("react"); -function Greet(x) { - return React.createElement("div", null, "Hello, ", x); -} class BigGreeter extends React.Component { render() { return React.createElement("div", null); } } -React.createElement(Greet, null), React.createElement(Greet, { - key: "k" -}), React.createElement(Greet, { - ref: "myRef" -}), React.createElement(BigGreeter, { - ref: (x)=>x.greeting.substr(10) -}), React.createElement(BigGreeter, { - ref: (x)=>x.greeting.subtr(10) -}), React.createElement(BigGreeter, { - ref: (x)=>x.notARealProperty -}), React.createElement(BigGreeter, { - key: 100 -}), React.createElement("div", { - ref: (x)=>x.innerText -}), React.createElement("div", { - ref: (x)=>x.propertyNotOnHtmlDivElement -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents2_es5.2.minified.js index b8ddf2430e8..6a563d56f9f 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents2_es5.2.minified.js @@ -1,9 +1,5 @@ import * as swcHelpers from "@swc/helpers"; -var React = require("react"); -function Greet(x) { - return React.createElement("div", null, "Hello, ", x); -} -var BigGreeter = function(_Component) { +var React = require("react"), BigGreeter = function(_Component) { "use strict"; swcHelpers.inherits(BigGreeter, _Component); var _super = swcHelpers.createSuper(BigGreeter); @@ -14,30 +10,3 @@ var BigGreeter = function(_Component) { return React.createElement("div", null); }, BigGreeter; }(React.Component); -React.createElement(Greet, null), React.createElement(Greet, { - key: "k" -}), React.createElement(Greet, { - ref: "myRef" -}), React.createElement(BigGreeter, { - ref: function(x) { - return x.greeting.substr(10); - } -}), React.createElement(BigGreeter, { - ref: function(x) { - return x.greeting.subtr(10); - } -}), React.createElement(BigGreeter, { - ref: function(x) { - return x.notARealProperty; - } -}), React.createElement(BigGreeter, { - key: 100 -}), React.createElement("div", { - ref: function(x) { - return x.innerText; - } -}), React.createElement("div", { - ref: function(x) { - return x.propertyNotOnHtmlDivElement; - } -}); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents3_es2015.2.minified.js index 0dcb2f7d6ef..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents3_es2015.2.minified.js @@ -1,5 +1,2 @@ -const React = require("react"); -React.createElement((props)=>React.createElement("div", null) -, null), (props)=>React.createElement("div", null, React.createElement("h3", null, "Main Menu")) -; +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents3_es5.2.minified.js index 41f4095ecb7..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponents3_es5.2.minified.js @@ -1,5 +1,2 @@ -var React = require("react"); -React.createElement(function(props) { - return React.createElement("div", null); -}, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1_es2015.2.minified.js index cd44e766189..96ea2a66ae6 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1_es2015.2.minified.js @@ -1,11 +1,2 @@ import * as swcHelpers from "@swc/helpers"; -const React = require("react"); -React.createElement(InferParamComponent, { - values: [ - 1, - 2, - 3, - 4 - ], - selectHandler: (val)=>{} -}); +require("react"); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1_es5.2.minified.js index 2d6b95ab5d5..bcc75df2564 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments1_es5.2.minified.js @@ -1,10 +1,2 @@ import * as swcHelpers from "@swc/helpers"; -require("react").createElement(InferParamComponent, { - values: [ - 1, - 2, - 3, - 4 - ], - selectHandler: function(val) {} -}); +require("react"), InferParamComponent; diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2_es2015.2.minified.js index cd44e766189..96ea2a66ae6 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2_es2015.2.minified.js @@ -1,11 +1,2 @@ import * as swcHelpers from "@swc/helpers"; -const React = require("react"); -React.createElement(InferParamComponent, { - values: [ - 1, - 2, - 3, - 4 - ], - selectHandler: (val)=>{} -}); +require("react"); diff --git a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2_es5.2.minified.js index 2d6b95ab5d5..bcc75df2564 100644 --- a/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxStatelessFunctionComponentsWithTypeArguments2_es5.2.minified.js @@ -1,10 +1,2 @@ import * as swcHelpers from "@swc/helpers"; -require("react").createElement(InferParamComponent, { - values: [ - 1, - 2, - 3, - 4 - ], - selectHandler: function(val) {} -}); +require("react"), InferParamComponent; diff --git a/crates/swc/tests/tsc-references/tsxTypeErrors_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxTypeErrors_es2015.2.minified.js index f59bae19196..e69de29bb2d 100644 --- a/crates/swc/tests/tsc-references/tsxTypeErrors_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxTypeErrors_es2015.2.minified.js @@ -1,21 +0,0 @@ -React.createElement("div", { - id: "foo" -}), React.createElement("img", { - srce: "foo.jpg" -}), React.createElement("div", { - id: { - oops: 100 - } -}), React.createElement("imag", { - src: "bar.jpg" -}); -class MyClass { -} -React.createElement(MyClass, { - reqd: !0 -}), React.createElement(MyClass, { - pt: { - x: 4, - y: "oops" - } -}); diff --git a/crates/swc/tests/tsc-references/tsxTypeErrors_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxTypeErrors_es5.2.minified.js index 0e4e1494ea5..77af659f518 100644 --- a/crates/swc/tests/tsc-references/tsxTypeErrors_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxTypeErrors_es5.2.minified.js @@ -1,24 +1,5 @@ import * as swcHelpers from "@swc/helpers"; -React.createElement("div", { - id: "foo" -}), React.createElement("img", { - srce: "foo.jpg" -}), React.createElement("div", { - id: { - oops: 100 - } -}), React.createElement("imag", { - src: "bar.jpg" -}); var MyClass = function() { "use strict"; swcHelpers.classCallCheck(this, MyClass); }; -React.createElement(MyClass, { - reqd: !0 -}), React.createElement(MyClass, { - pt: { - x: 4, - y: "oops" - } -}); diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType1_es2015.2.minified.js index 6592bf067f7..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType1_es2015.2.minified.js @@ -1,7 +1,2 @@ -const React = require("react"); -React.createElement(function(prop) { - return React.createElement("div", null, "hello"); -}, { - x: !0 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType1_es5.2.minified.js index 15823534e12..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType1_es5.2.minified.js @@ -1,7 +1,2 @@ -var React = require("react"); -React.createElement(function(prop) { - return React.createElement("div", null, "hello"); -}, { - x: !0 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType2_es2015.2.minified.js index 5bd1ce08e8e..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType2_es2015.2.minified.js @@ -1,7 +1,2 @@ -const React = require("react"); -React.createElement(function(prop) { - return React.createElement("div", null, "hello"); -}, { - x: "hi" -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType2_es5.2.minified.js index e077aea3b9b..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType2_es5.2.minified.js @@ -1,7 +1,2 @@ -var React = require("react"); -React.createElement(function(prop) { - return React.createElement("div", null, "hello"); -}, { - x: "hi" -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType3_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType3_es2015.2.minified.js index 5f949c10eda..77b92650036 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType3_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType3_es2015.2.minified.js @@ -20,12 +20,4 @@ class RC4 extends React.Component { return null; } } -var EmptyRCComp = RC3 || RC4, PartRCComp = RC1 || RC4; -React.createElement(RC1 || RC2, { - x: "Hi" -}), React.createElement(EmptyRCComp, null), React.createElement(EmptyRCComp, { - "data-prop": "hello" -}), React.createElement(PartRCComp, null), React.createElement(PartRCComp, { - "data-extra": "hello" -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType3_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType3_es5.2.minified.js index 7d299c8b930..3bfc0059646 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType3_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType3_es5.2.minified.js @@ -40,11 +40,4 @@ var React = require("react"), RC1 = function(_Component) { return RC4.prototype.render = function() { return null; }, RC4; -}(React.Component), EmptyRCComp = RC3 || RC4, PartRCComp = RC1 || RC4; -React.createElement(RC1 || RC2, { - x: "Hi" -}), React.createElement(EmptyRCComp, null), React.createElement(EmptyRCComp, { - "data-prop": "hello" -}), React.createElement(PartRCComp, null), React.createElement(PartRCComp, { - "data-extra": "hello" -}); +}(React.Component); diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType4_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType4_es2015.2.minified.js index c8628a4de36..77b92650036 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType4_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType4_es2015.2.minified.js @@ -20,11 +20,4 @@ class RC4 extends React.Component { return null; } } -React.createElement(RC1 || RC2, { - x: !0 -}), React.createElement(RC1 || RC4, { - x: 10 -}), React.createElement(RC3 || RC4, { - prop: !0 -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType4_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType4_es5.2.minified.js index 45d9a57ddeb..3bfc0059646 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType4_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType4_es5.2.minified.js @@ -41,10 +41,3 @@ var React = require("react"), RC1 = function(_Component) { return null; }, RC4; }(React.Component); -React.createElement(RC1 || RC2, { - x: !0 -}), React.createElement(RC1 || RC4, { - x: 10 -}), React.createElement(RC3 || RC4, { - prop: !0 -}); diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType5_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType5_es2015.2.minified.js index bfb069aed36..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType5_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType5_es2015.2.minified.js @@ -1,12 +1,2 @@ -const React = require("react"); -var EmptySFCComp = function() { - return React.createElement("div", null, "hello"); -}; -React.createElement(EmptySFCComp, null), React.createElement(EmptySFCComp, { - "data-prop": !0 -}), React.createElement(function(prop) { - return React.createElement("h1", null, "World"); -}, { - x: !0 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType5_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType5_es5.2.minified.js index 4e3d09cc636..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType5_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType5_es5.2.minified.js @@ -1,11 +1,2 @@ -var React = require("react"), EmptySFCComp = function() { - return React.createElement("div", null, "hello"); -}; -React.createElement(EmptySFCComp, null), React.createElement(EmptySFCComp, { - "data-prop": !0 -}), React.createElement(function(prop) { - return React.createElement("h1", null, "World"); -}, { - x: !0 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType6_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType6_es2015.2.minified.js index d64b45cb99a..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType6_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType6_es2015.2.minified.js @@ -1,14 +1,2 @@ -const React = require("react"); -var SFC2AndEmptyComp = function(prop) { - return React.createElement("h1", null, "World"); -}; -React.createElement(function() { - return React.createElement("div", null, "Hi"); -}, { - x: !0 -}), React.createElement(SFC2AndEmptyComp, { - x: "hi" -}), React.createElement(SFC2AndEmptyComp, null), React.createElement(SFC2AndEmptyComp, { - "data-prop": !0 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionElementType6_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionElementType6_es5.2.minified.js index 3b1dc363b3b..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionElementType6_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionElementType6_es5.2.minified.js @@ -1,13 +1,2 @@ -var React = require("react"), SFC2AndEmptyComp = function(prop) { - return React.createElement("h1", null, "World"); -}; -React.createElement(function() { - return React.createElement("div", null, "Hi"); -}, { - x: !0 -}), React.createElement(SFC2AndEmptyComp, { - x: "hi" -}), React.createElement(SFC2AndEmptyComp, null), React.createElement(SFC2AndEmptyComp, { - "data-prop": !0 -}); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionTypeComponent1_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionTypeComponent1_es2015.2.minified.js index 45b02f6099a..112220aabc5 100644 --- a/crates/swc/tests/tsc-references/tsxUnionTypeComponent1_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionTypeComponent1_es2015.2.minified.js @@ -5,12 +5,6 @@ class MyComponent extends React.Component { return React.createElement(AnyComponent, null); } } -React.createElement(MyComponent, { - AnyComponent: ()=>React.createElement("button", null, "test") -}); class MyButtonComponent extends React.Component { } -React.createElement(MyComponent, { - AnyComponent: MyButtonComponent -}); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionTypeComponent1_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionTypeComponent1_es5.2.minified.js index fc2785acb6a..fe2300f94c2 100644 --- a/crates/swc/tests/tsc-references/tsxUnionTypeComponent1_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionTypeComponent1_es5.2.minified.js @@ -10,13 +10,7 @@ var React = require("react"), MyComponent = function(_Component) { var AnyComponent = this.props.AnyComponent; return React.createElement(AnyComponent, null); }, MyComponent; -}(React.Component); -React.createElement(MyComponent, { - AnyComponent: function() { - return React.createElement("button", null, "test"); - } -}); -var MyButtonComponent = function(_Component) { +}(React.Component), MyButtonComponent = function(_Component) { "use strict"; swcHelpers.inherits(MyButtonComponent, _Component); var _super = swcHelpers.createSuper(MyButtonComponent); @@ -25,6 +19,3 @@ var MyButtonComponent = function(_Component) { } return MyButtonComponent; }(React.Component); -React.createElement(MyComponent, { - AnyComponent: MyButtonComponent -}); diff --git a/crates/swc/tests/tsc-references/tsxUnionTypeComponent2_es2015.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionTypeComponent2_es2015.2.minified.js index f42f2cf34ff..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionTypeComponent2_es2015.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionTypeComponent2_es2015.2.minified.js @@ -1,3 +1,2 @@ -const React = require("react"); -React.createElement(1, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/tsxUnionTypeComponent2_es5.2.minified.js b/crates/swc/tests/tsc-references/tsxUnionTypeComponent2_es5.2.minified.js index 0f9e4354adf..c057c0f4bf4 100644 --- a/crates/swc/tests/tsc-references/tsxUnionTypeComponent2_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/tsxUnionTypeComponent2_es5.2.minified.js @@ -1,2 +1,2 @@ -require("react").createElement(1, null); +require("react"); export { }; diff --git a/crates/swc/tests/tsc-references/uniqueSymbols_es5.2.minified.js b/crates/swc/tests/tsc-references/uniqueSymbols_es5.2.minified.js index d7717fe9d1e..b3ac71116c9 100644 --- a/crates/swc/tests/tsc-references/uniqueSymbols_es5.2.minified.js +++ b/crates/swc/tests/tsc-references/uniqueSymbols_es5.2.minified.js @@ -119,15 +119,4 @@ regeneratorRuntime.mark(function method4() { return _ctx.stop(); } }, method4); -}), function() { - "use strict"; - function _class() { - swcHelpers.classCallCheck(this, _class); - } - var _proto = _class.prototype; - _proto.method1 = function(p) { - return p; - }, _proto.method2 = function(p) { - return p; - }; -}(); +}); diff --git a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs index 898e1385398..d37874107e2 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs @@ -866,6 +866,53 @@ where return None; } + Expr::Call(CallExpr { span, args, .. }) if span.has_mark(self.marks.pure) => { + tracing::debug!("ignore_return_value: Dropping a pure call"); + self.changed = true; + return if args.is_empty() { + None + } else { + Some(Expr::Seq(SeqExpr { + span: DUMMY_SP, + exprs: args.take().into_iter().map(|arg| arg.expr).collect(), + })) + }; + } + + Expr::TaggedTpl(TaggedTpl { + span, + tpl: Tpl { exprs, .. }, + .. + }) if span.has_mark(self.marks.pure) => { + tracing::debug!("ignore_return_value: Dropping a pure call"); + self.changed = true; + return if exprs.is_empty() { + None + } else { + Some(Expr::Seq(SeqExpr { + span: DUMMY_SP, + exprs: exprs.take(), + })) + }; + } + + Expr::New(NewExpr { span, args, .. }) if span.has_mark(self.marks.pure) => { + tracing::debug!("ignore_return_value: Dropping a pure call"); + self.changed = true; + return if let Some(args) = args.take() { + if args.is_empty() { + None + } else { + Some(Expr::Seq(SeqExpr { + span: DUMMY_SP, + exprs: args.into_iter().map(|arg| arg.expr).collect(), + })) + } + } else { + None + }; + } + Expr::Call(CallExpr { callee: Callee::Expr(callee), args, diff --git a/crates/swc_ecma_minifier/src/metadata/mod.rs b/crates/swc_ecma_minifier/src/metadata/mod.rs index 6f1a89c746c..8b74b1194ae 100644 --- a/crates/swc_ecma_minifier/src/metadata/mod.rs +++ b/crates/swc_ecma_minifier/src/metadata/mod.rs @@ -66,6 +66,11 @@ impl InfoMarker<'_> { self.has_flag(span, "NOINLINE") } + /// Check for `/*#__PURE__*/` + pub(super) fn has_pure(&self, span: Span) -> bool { + self.has_flag(span, "PURE") + } + fn find_comment(&self, span: Span, mut op: F) -> bool where F: FnMut(&Comment) -> bool, @@ -113,6 +118,18 @@ impl VisitMut for InfoMarker<'_> { if self.has_noinline(n.span) { n.span = n.span.apply_mark(self.marks.noinline); } + + if self.has_pure(n.span) { + n.span = n.span.apply_mark(self.marks.pure); + } + } + + fn visit_mut_new_expr(&mut self, n: &mut NewExpr) { + n.visit_mut_children_with(self); + + if self.has_pure(n.span) { + n.span = n.span.apply_mark(self.marks.pure); + } } fn visit_mut_export_default_decl(&mut self, e: &mut ExportDefaultDecl) { diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/issues/quagga2/1.4.2/1/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/issues/quagga2/1.4.2/1/output.js index c15c6057387..41a2e63b63d 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/issues/quagga2/1.4.2/1/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/issues/quagga2/1.4.2/1/output.js @@ -454,9 +454,7 @@ }, function(module, __webpack_exports__, __webpack_require__) { "use strict"; - var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(83), _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__), _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3), _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__), _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4), _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3__), gl_vec2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7); - __webpack_require__.n(gl_vec2__WEBPACK_IMPORTED_MODULE_4__); - var _cv_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8), _array_helper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10), vec2 = { + var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(83), _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__), _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3), _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_1__), _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4), _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_2__), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_3__), gl_vec2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7), _cv_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(8), _array_helper__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10), vec2 = { clone: gl_vec2__WEBPACK_IMPORTED_MODULE_4__.clone }; function assertNumberPositive(val) { @@ -760,11 +758,7 @@ function(module, __webpack_exports__, __webpack_require__) { "use strict"; (function(global) { - var _config, _currentImageWrapper, _skelImageWrapper, _subImageWrapper, _labelImageWrapper, _patchGrid, _patchLabelGrid, _imageToPatchGrid, _binaryImageWrapper, _patchSize, _inputImageWrapper, _skeletonizer, gl_vec2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7); - __webpack_require__.n(gl_vec2__WEBPACK_IMPORTED_MODULE_0__); - var gl_mat2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34); - __webpack_require__.n(gl_mat2__WEBPACK_IMPORTED_MODULE_1__); - var _common_image_wrapper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11), _common_cv_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8), _common_array_helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(10), _common_image_debug__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9), _rasterizer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(87), _tracer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(21), _skeletonizer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(88), _canvasContainer = { + var _config, _currentImageWrapper, _skelImageWrapper, _subImageWrapper, _labelImageWrapper, _patchGrid, _patchLabelGrid, _imageToPatchGrid, _binaryImageWrapper, _patchSize, _inputImageWrapper, _skeletonizer, gl_vec2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7), gl_mat2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(34), _common_image_wrapper__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11), _common_cv_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8), _common_array_helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(10), _common_image_debug__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9), _rasterizer__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(87), _tracer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(21), _skeletonizer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(88), _canvasContainer = { ctx: { binary: null }, diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js index d4ddad576ce..ea7f46e25f1 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js @@ -5,9 +5,7 @@ ], { 5215: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { - var browserApi, videojs$1, FakeWeakMap1, _supportsPassive, EVENT_MAP, canPlayType, Vhs$1, global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8908), global_window__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__), global_document__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9144), global_document__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(global_document__WEBPACK_IMPORTED_MODULE_1__), _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(7462), _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(7326), _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(4578), safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5974), safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2__), keycode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7537), keycode__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(keycode__WEBPACK_IMPORTED_MODULE_3__), _videojs_xhr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9603), _videojs_xhr__WEBPACK_IMPORTED_MODULE_4___default = __webpack_require__.n(_videojs_xhr__WEBPACK_IMPORTED_MODULE_4__), videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3407), videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default = __webpack_require__.n(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5__), _babel_runtime_helpers_construct__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(8852), _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(136), _videojs_vhs_utils_es_resolve_url_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(779), m3u8_parser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9323), _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2260), _videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(8485), mpd_parser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(973), mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4221), mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10___default = __webpack_require__.n(mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10__), _videojs_vhs_utils_es_id3_helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8925), _videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6185), _videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(562), mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(1489); - __webpack_require__.n(mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_14__); - for(var version$5 = "7.17.0", hooks_ = {}, hooks = function(type, fn) { + for(var browserApi, videojs$1, FakeWeakMap1, _supportsPassive, EVENT_MAP, canPlayType, Vhs$1, global_window__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8908), global_window__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(global_window__WEBPACK_IMPORTED_MODULE_0__), global_document__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9144), global_document__WEBPACK_IMPORTED_MODULE_1___default = __webpack_require__.n(global_document__WEBPACK_IMPORTED_MODULE_1__), _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(7462), _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(7326), _babel_runtime_helpers_inheritsLoose__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(4578), safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5974), safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2___default = __webpack_require__.n(safe_json_parse_tuple__WEBPACK_IMPORTED_MODULE_2__), keycode__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(7537), keycode__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(keycode__WEBPACK_IMPORTED_MODULE_3__), _videojs_xhr__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(9603), _videojs_xhr__WEBPACK_IMPORTED_MODULE_4___default = __webpack_require__.n(_videojs_xhr__WEBPACK_IMPORTED_MODULE_4__), videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3407), videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5___default = __webpack_require__.n(videojs_vtt_js__WEBPACK_IMPORTED_MODULE_5__), _babel_runtime_helpers_construct__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(8852), _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(136), _videojs_vhs_utils_es_resolve_url_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(779), m3u8_parser__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9323), _videojs_vhs_utils_es_codecs_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(2260), _videojs_vhs_utils_es_media_types_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(8485), mpd_parser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(973), mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(4221), mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10___default = __webpack_require__.n(mux_js_lib_tools_parse_sidx__WEBPACK_IMPORTED_MODULE_10__), _videojs_vhs_utils_es_id3_helpers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(8925), _videojs_vhs_utils_es_containers__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(6185), _videojs_vhs_utils_es_byte_helpers__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(562), mux_js_lib_utils_clock__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(1489), version$5 = "7.17.0", hooks_ = {}, hooks = function(type, fn) { return hooks_[type] = hooks_[type] || [], fn && (hooks_[type] = hooks_[type].concat(fn)), hooks_[type]; }, removeHook = function(type, fn) { var index = hooks(type).indexOf(fn); diff --git a/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js b/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js index 362941d9787..6d1e42f3443 100644 --- a/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js +++ b/crates/swc_ecma_minifier/tests/compress/fixture/next/feedback-util-promisify/chunks/pages/_app-72ad41192608e93a/output.js @@ -19,7 +19,7 @@ 8484: function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); - var _Users_kdy1_projects_lab_swc_minify_issue_node_modules_next_dist_compiled_regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4051), _Users_kdy1_projects_lab_swc_minify_issue_node_modules_next_dist_compiled_regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_Users_kdy1_projects_lab_swc_minify_issue_node_modules_next_dist_compiled_regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__), react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5893), react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7294), util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9720), util__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_3__), _styles_globals_css__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(6774); + var _Users_kdy1_projects_lab_swc_minify_issue_node_modules_next_dist_compiled_regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4051), _Users_kdy1_projects_lab_swc_minify_issue_node_modules_next_dist_compiled_regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_Users_kdy1_projects_lab_swc_minify_issue_node_modules_next_dist_compiled_regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0__), react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5893), react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7294), util__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9720), util__WEBPACK_IMPORTED_MODULE_3___default = __webpack_require__.n(util__WEBPACK_IMPORTED_MODULE_3__); function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg), value = info.value; @@ -37,7 +37,7 @@ writable: !0 }) : obj[key] = value, obj; } - __webpack_require__.n(_styles_globals_css__WEBPACK_IMPORTED_MODULE_4__); + __webpack_require__(6774); var fn, _ref, initBranch = (fn = _Users_kdy1_projects_lab_swc_minify_issue_node_modules_next_dist_compiled_regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0___default().mark(function _callee() { return _Users_kdy1_projects_lab_swc_minify_issue_node_modules_next_dist_compiled_regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_0___default().wrap(function(_ctx) { for(;;)switch(_ctx.prev = _ctx.next){