UNPKG

prepack

Version:

Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.

76 lines (54 loc) 2.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReconcilerFatalError = exports.DoNotOptimize = exports.NewComponentTreeBranch = exports.UnsupportedSideEffect = exports.SimpleClassBailOut = exports.ExpectedBailOut = void 0; var _errors = require("../errors.js"); /** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ /* strict-local */ // ExpectedBailOut is like an error, that gets thrown during the reconcilation phase // allowing the reconcilation to continue on other branches of the tree, the message // given to ExpectedBailOut will be assigned to the value.$BailOutReason property and serialized // as a comment in the output source to give the user hints as to what they need to do // to fix the bail-out case class ExpectedBailOut extends Error {} // SimpleClassBailOuts only occur when a simple class instance is created and used // bailing out here will result in a complex class instance being created after // and an alternative complex class component route being used exports.ExpectedBailOut = ExpectedBailOut; class SimpleClassBailOut extends Error {} // When the reconciler detectes a side-effect in pure evaluation, it throws one // of these errors. This will fall straight through the the wrapping React // component render try/catch, which will then throw an appropiate // ReconcilerFatalError along with information on the React component stack exports.SimpleClassBailOut = SimpleClassBailOut; class UnsupportedSideEffect extends Error {} // NewComponentTreeBranch only occur when a complex class is found in a // component tree and the reconciler can no longer fold the component of that branch exports.UnsupportedSideEffect = UnsupportedSideEffect; class NewComponentTreeBranch extends Error { constructor(evaluatedNode) { super(); this.evaluatedNode = evaluatedNode; } } exports.NewComponentTreeBranch = NewComponentTreeBranch; class DoNotOptimize extends Error {} // Used when an entire React component tree has failed to optimize // this means there is a programming bug in the application that is // being Prepacked exports.DoNotOptimize = DoNotOptimize; class ReconcilerFatalError extends _errors.FatalError { constructor(message, evaluatedNode) { super(message); evaluatedNode.status = "FATAL"; evaluatedNode.message = message; this.evaluatedNode = evaluatedNode; // used for assertions in tests this.__isReconcilerFatalError = true; } } exports.ReconcilerFatalError = ReconcilerFatalError; //# sourceMappingURL=errors.js.map