How to use reify - 10 common examples

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;
github standard-things / esm / packages / babel-plugin-transform-es2015-modules-reify / index.js View on Github external
module.exports = function () {
  var compiler = require("reify/lib/compiler.js");
  var parse = require("reify/lib/parser/babylon.js").parse;
  var validators = require("babel-types/lib/validators");
  var ibs = validators.isBlockScoped;
  var t = require("babel-types");

  // Allow t.isBlockScoped to return true for import-related nodes.
  validators.isBlockScoped = function (node) {
    return node &&
      t.isImportDeclaration(node) ||
      ibs.apply(this, arguments);
  };

  function removeLiveBindingUpdateViolations(scope, opts) {
    Object.keys(scope.bindings).forEach(function (name) {
      var b = scope.bindings[name];
      if (b.kind === "module") {
        // Make the binding have a "let" or "var" kind from the
github meteor / babel / options.js View on Github external
function finish(features, presets) {
  const options = {
    compact: false,
    sourceMaps: false,
    ast: false,
    // Disable .babelrc lookup and processing.
    babelrc: false,
    // Disable babel.config.js lookup and processing.
    configFile: false,
    parserOpts: util.deepClone(parserOpts),
    presets: presets
  };

  if (features && features.typescript) {
    // This additional option will be consumed by the meteorBabel.compile
    // function before the options are passed to Babel.
    options.typescript = true;
  }

  return options;
}
github benjamn / ast-types / test / shared.ts View on Github external
export function babylonParse(source: any, options?: any) {
  var ast = reifyBabylonParse(source, options);
  if (ast.type === "File") ast = ast.program;
  return ast;
}
github lorengreenfield / halfcab / wallaby.config.js View on Github external
                file => require('reify/lib/compiler').compile(file.content)
            ]
github standard-things / esm / packages / babel-plugin-transform-es2015-modules-reify / index.js View on Github external
Program: function (path) {
        var transformOptions = {
          parse: parse
        };

        var code = path.hub.file.code;
        if (typeof code === "string") {
          transformOptions.moduleAlias =
            compiler.makeUniqueId("module", code);
        }

        compiler.transform(
          path.node,
          Object.assign(transformOptions, this.opts)
        );
      }
    }