How to use the reify/lib/runtime.enable function in reify

To help you get started, we’ve selected a few reify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github benjamn / install / test / run.js View on Github external
b: function (r, exports, module) {
        exports.one = 1;

        // Enable module.link.
        reify(module);

        module.link("./a", {
          one: function (v) {
            markers.push("ba1", v);
          },

          two: function (v) {
            markers.push("ba2", v);
          }
        });

        exports.two = 2;
      }
    });
github meteor / babel / runtime.js View on Github external
require("meteor-babel-helpers");

var Module = module.constructor;

// The Reify runtime now requires a working implementation of
// module.resolve, which should return a canonical absolute module
// identifier string, like require.resolve(id).
Module.prototype.resolve = function (id) {
  return Module._resolveFilename(id, this);
};

require("reify/lib/runtime").enable(Module.prototype);

require("meteor-promise").makeCompatible(
  global.Promise = global.Promise ||
    require("promise/lib/es6-extensions"),
  require("fibers")
);

// If Promise.asyncApply is defined, use it to wrap calls to
// regeneratorRuntime.async so that the entire async function will run in
// its own Fiber, not just the code that comes after the first await.
if (typeof Promise.asyncApply === "function") {
  var regeneratorRuntime = require("@babel/runtime/regenerator");
  var realAsync = regeneratorRuntime.async;
  regeneratorRuntime.async = function (innerFn) {
    return Promise.asyncApply(realAsync, regeneratorRuntime, arguments);
  };
github steedos / object-server / server / bundle / programs / server / packages / modules.js View on Github external
},"reify.js":function(require,exports,module){

//////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                  //
// packages/modules/reify.js                                                                        //
//                                                                                                  //
//////////////////////////////////////////////////////////////////////////////////////////////////////
                                                                                                    //
require("reify/lib/runtime").enable(
  module.constructor.prototype
);

//////////////////////////////////////////////////////////////////////////////////////////////////////

},"node_modules":{"reify":{"lib":{"runtime":{"index.js":function(require,exports,module){
github meteor / babel / register.js View on Github external
var assert = require("assert");
var path = require("path");
var fs = require("fs");
var hasOwn = Object.hasOwnProperty;
var convertSourceMap = require("convert-source-map");
var meteorBabel = require("./index.js");
var util = require("./util.js");

var Module = module.constructor;
require("reify/lib/runtime").enable(Module.prototype);

var config = {
  sourceMapRootPath: null,
  cacheDirectory: process.env.BABEL_CACHE_DIR,
  allowedDirectories: Object.create(null),
  babelOptions: null
};

function setBabelOptions(options) {
  config.babelOptions = util.deepClone(options);
  // Overrides for default options:
  config.babelOptions.sourceMaps = true;
  return exports;
}

// Set default config.babelOptions.
github meteor / babel / index.js View on Github external
"use strict";

const assert = require("assert");
const Cache = require("./cache.js");
const util = require("./util.js");
const cachesByDir = Object.create(null);
const BABEL_CACHE_DIR = process.env.BABEL_CACHE_DIR;
let options; // Lazily initialized.

// Make sure that module.importSync and module.export are defined in the
// current Node process.
const Module = module.constructor;
require("reify/lib/runtime").enable(Module.prototype);

// Options passed to compile will completely replace the default options,
// so if you only want to modify the default options, call this function
// first, modify the result, and then pass those options to compile.
function getDefaultOptions(features) {
  options = options || require("./options.js");
  return options.getDefaults(features);
}
exports.getDefaultOptions = getDefaultOptions;

function getMinifierOptions(features) {
  options = options || require("./options.js");
  return options.getMinifierDefaults(features);
}
exports.getMinifierOptions = getMinifierOptions;