Diff
checker
Testo
Testo
Immagini
Documenti
Excel
Cartelle
Legal
Enterprise
Applicazione per desktop
Prezzi
Accedi
Scarica Diffchecker Desktop
Confronta il testo
Trova la differenza tra due file di testo
Strumenti
Cronologia
Editor live
Comprimi invariate
Senza a capo
Layout
Diviso
Unificato
Livello di dettaglio
Intelligente
Parola
Carattere
Evidenziazione sintassi
Scegli sintassi
Ignora
Trasforma testo
Vai alla prima modifica
Modifica input
Diffchecker Desktop
Il modo più sicuro per usare Diffchecker. Ottieni l'app Diffchecker Desktop: i tuoi diff non lasciano mai il tuo computer!
Ottieni Desktop
react-jsx-dev
Creato
5 anni fa
Il diff non scade mai
Eliminare
Esporta
Condividere
Spiegare
3 rimozioni
Linee
Totale
Rimosso
Caratteri
Totale
Rimosso
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
63 linee
Copia tutti
2 aggiunte
Linee
Totale
Aggiunto
Caratteri
Totale
Aggiunto
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
61 linee
Copia tutti
Copia
Copiato
Copia
Copiato
// @babel/plugin-transform-react-jsx
// @babel/plugin-transform-react-jsx
-development
import jsx from "@babel/plugin-syntax-jsx";
import jsx from "@babel/plugin-syntax-jsx";
import { helper } from "@babel/helper-builder-react-jsx-experimental";
import { helper } from "@babel/helper-builder-react-jsx-experimental";
import { declare } from "@babel/helper-plugin-utils";
import { declare } from "@babel/helper-plugin-utils";
import { types as t } from "@babel/core";
import { types as t } from "@babel/core";
export default declare((api, options) => {
export default declare((api, options) => {
Copia
Copiato
Copia
Copiato
const { runtime = "classic" } = options;
const PURE_ANNOTATION = options.pure;
const PURE_ANNOTATION = options.pure;
const visitor = helper(api, {
const visitor = helper(api, {
pre(state) {
pre(state) {
const tagName = state.tagName;
const tagName = state.tagName;
const args = state.args;
const args = state.args;
if (t.react.isCompatTag(tagName)) {
if (t.react.isCompatTag(tagName)) {
args.push(t.stringLiteral(tagName));
args.push(t.stringLiteral(tagName));
} else {
} else {
args.push(state.tagExpr);
args.push(state.tagExpr);
}
}
},
},
post(state, pass) {
post(state, pass) {
if (pass.get("@babel/plugin-react-jsx/runtime") === "classic") {
if (pass.get("@babel/plugin-react-jsx/runtime") === "classic") {
state.createElementCallee = pass.get(
state.createElementCallee = pass.get(
"@babel/plugin-react-jsx/createElementIdentifier",
"@babel/plugin-react-jsx/createElementIdentifier",
)();
)();
state.pure =
state.pure =
PURE_ANNOTATION ?? !pass.get("@babel/plugin-react-jsx/pragmaSet");
PURE_ANNOTATION ?? !pass.get("@babel/plugin-react-jsx/pragmaSet");
} else {
} else {
const getter = get => ({ enumerable: true, configurable: true, get });
const getter = get => ({ enumerable: true, configurable: true, get });
// TODO(Babel 8): helper-builder-react-jsx expects those properties to be AST nodes, but we want to
// TODO(Babel 8): helper-builder-react-jsx expects those properties to be AST nodes, but we want to
// generate them lazily so that we only inject imports when needed.
// generate them lazily so that we only inject imports when needed.
// These should actually be functions.
// These should actually be functions.
Object.defineProperties(state, {
Object.defineProperties(state, {
jsxCallee: getter(pass.get("@babel/plugin-react-jsx/jsxIdentifier")),
jsxCallee: getter(pass.get("@babel/plugin-react-jsx/jsxIdentifier")),
jsxStaticCallee: getter(
jsxStaticCallee: getter(
pass.get("@babel/plugin-react-jsx/jsxStaticIdentifier"),
pass.get("@babel/plugin-react-jsx/jsxStaticIdentifier"),
),
),
createElementCallee: getter(
createElementCallee: getter(
pass.get("@babel/plugin-react-jsx/createElementIdentifier"),
pass.get("@babel/plugin-react-jsx/createElementIdentifier"),
),
),
});
});
state.pure =
state.pure =
PURE_ANNOTATION ??
PURE_ANNOTATION ??
!pass.get("@babel/plugin-react-jsx/importSourceSet");
!pass.get("@babel/plugin-react-jsx/importSourceSet");
}
}
},
},
...options,
...options,
Copia
Copiato
Copia
Copiato
development:
false,
development:
true
,
runtime
,
});
});
return {
return {
name: "transform-react-jsx",
name: "transform-react-jsx",
inherits: jsx,
inherits: jsx,
visitor,
visitor,
};
};
});
});
Diff salvati
Testo originale
Apri file
// @babel/plugin-transform-react-jsx import jsx from "@babel/plugin-syntax-jsx"; import { helper } from "@babel/helper-builder-react-jsx-experimental"; import { declare } from "@babel/helper-plugin-utils"; import { types as t } from "@babel/core"; export default declare((api, options) => { const { runtime = "classic" } = options; const PURE_ANNOTATION = options.pure; const visitor = helper(api, { pre(state) { const tagName = state.tagName; const args = state.args; if (t.react.isCompatTag(tagName)) { args.push(t.stringLiteral(tagName)); } else { args.push(state.tagExpr); } }, post(state, pass) { if (pass.get("@babel/plugin-react-jsx/runtime") === "classic") { state.createElementCallee = pass.get( "@babel/plugin-react-jsx/createElementIdentifier", )(); state.pure = PURE_ANNOTATION ?? !pass.get("@babel/plugin-react-jsx/pragmaSet"); } else { const getter = get => ({ enumerable: true, configurable: true, get }); // TODO(Babel 8): helper-builder-react-jsx expects those properties to be AST nodes, but we want to // generate them lazily so that we only inject imports when needed. // These should actually be functions. Object.defineProperties(state, { jsxCallee: getter(pass.get("@babel/plugin-react-jsx/jsxIdentifier")), jsxStaticCallee: getter( pass.get("@babel/plugin-react-jsx/jsxStaticIdentifier"), ), createElementCallee: getter( pass.get("@babel/plugin-react-jsx/createElementIdentifier"), ), }); state.pure = PURE_ANNOTATION ?? !pass.get("@babel/plugin-react-jsx/importSourceSet"); } }, ...options, development: false, runtime, }); return { name: "transform-react-jsx", inherits: jsx, visitor, }; });
Testo modificato
Apri file
// @babel/plugin-transform-react-jsx-development import jsx from "@babel/plugin-syntax-jsx"; import { helper } from "@babel/helper-builder-react-jsx-experimental"; import { declare } from "@babel/helper-plugin-utils"; import { types as t } from "@babel/core"; export default declare((api, options) => { const PURE_ANNOTATION = options.pure; const visitor = helper(api, { pre(state) { const tagName = state.tagName; const args = state.args; if (t.react.isCompatTag(tagName)) { args.push(t.stringLiteral(tagName)); } else { args.push(state.tagExpr); } }, post(state, pass) { if (pass.get("@babel/plugin-react-jsx/runtime") === "classic") { state.createElementCallee = pass.get( "@babel/plugin-react-jsx/createElementIdentifier", )(); state.pure = PURE_ANNOTATION ?? !pass.get("@babel/plugin-react-jsx/pragmaSet"); } else { const getter = get => ({ enumerable: true, configurable: true, get }); // TODO(Babel 8): helper-builder-react-jsx expects those properties to be AST nodes, but we want to // generate them lazily so that we only inject imports when needed. // These should actually be functions. Object.defineProperties(state, { jsxCallee: getter(pass.get("@babel/plugin-react-jsx/jsxIdentifier")), jsxStaticCallee: getter( pass.get("@babel/plugin-react-jsx/jsxStaticIdentifier"), ), createElementCallee: getter( pass.get("@babel/plugin-react-jsx/createElementIdentifier"), ), }); state.pure = PURE_ANNOTATION ?? !pass.get("@babel/plugin-react-jsx/importSourceSet"); } }, ...options, development: true, }); return { name: "transform-react-jsx", inherits: jsx, visitor, }; });
Trovare la differenza