Giter VIP home page Giter VIP logo

juse's Introduction

Juse: A Jest script transformer backed FUSE implementation, which allows you to access the FS with files transformed in place by Jest’s script transformer.

⚠️ This is just a proof-of-concept. It is slow, naive, and unpolished.

Install

Install dependencies:

git clone https://github.com/alloy/juse.git
cd juse
yarn install

Configure FUSE kernel extension once:

yarn fuse-native is-configured
false
sudo yarn fuse-native configure

Build code:

yarn build

Usage

Mount a jest configured project:

cd my-project
mkdir /tmp/my-project-mount-point
node path/to/juse/index.js /tmp/my-project-mount-point

Now files that would be transformed by jest in your project will be transformed in place when accessing them. E.g. for a TS file like:

import { NativeModules } from "react-native"
const { Emission } = NativeModules

import { Sentry } from "react-native-sentry"

// AREmission sets this to "" if not configured, which is falsy in JS so this conditional is fine.
if (Emission.sentryDSN) {
  Sentry.config(Emission.sentryDSN).install()
}

…accessing it like so:

cat /tmp/my-project-mount-point/a-file-in-your-project.ts

…will show:

var _reactNative = require("react-native");

var _reactNativeSentry = require("react-native-sentry");

var Emission = _reactNative.NativeModules.Emission;

if (Emission.sentryDSN) {
  _reactNativeSentry.Sentry.config(Emission.sentryDSN).install();
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkVycm9yUmVwb3J0aW5nLnRzIl0sIm5hbWVzIjpbIkVtaXNzaW9uIiwiTmF0aXZlTW9kdWxlcyIsInNlbnRyeURTTiIsIlNlbnRyeSIsImNvbmZpZyIsImluc3RhbGwiXSwibWFwcGluZ3MiOiJBQUFBOztBQUdBOztJQUZRQSxRLEdBQWFDLDBCLENBQWJELFE7O0FBS1IsSUFBSUEsUUFBUSxDQUFDRSxTQUFiLEVBQXdCO0FBQ3RCQyw0QkFBT0MsTUFBUCxDQUFjSixRQUFRLENBQUNFLFNBQXZCLEVBQWtDRyxPQUFsQztBQUNEIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgTmF0aXZlTW9kdWxlcyB9IGZyb20gXCJyZWFjdC1uYXRpdmVcIlxuY29uc3QgeyBFbWlzc2lvbiB9ID0gTmF0aXZlTW9kdWxlc1xuXG5pbXBvcnQgeyBTZW50cnkgfSBmcm9tIFwicmVhY3QtbmF0aXZlLXNlbnRyeVwiXG5cbi8vIEFSRW1pc3Npb24gc2V0cyB0aGlzIHRvIFwiXCIgaWYgbm90IGNvbmZpZ3VyZWQsIHdoaWNoIGlzIGZhbHN5IGluIEpTIHNvIHRoaXMgY29uZGl0aW9uYWwgaXMgZmluZS5cbmlmIChFbWlzc2lvbi5zZW50cnlEU04pIHtcbiAgU2VudHJ5LmNvbmZpZyhFbWlzc2lvbi5zZW50cnlEU04pLmluc3RhbGwoKVxufVxuIl19⏎

TODO

  • Read source files non-block, unlike what the ScriptTransformer does. Unsure what Jest offers.
  • Fill build cache ahead of time. Unsure what Jest offers.
  • Use Jest’s platform aware resolver to check if files should be transformed.
  • Rename file extnames to .js

juse's People

Contributors

alloy avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.