npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@mediamonks/tawang

v0.2.4

Published

A webpack plugin for Facebook's AR Studio.

Downloads

12

Readme

Tawang

This plugin makes webpack compatible with Facebook’s AR Studio. With this plugin, it is possible to debug an AR Studio script using source maps. It uses an external API to parse the source map which webpack generates. You can create such an API using the Tawang-API Git repository.

Install

npm i -D @mediamonks/tawang

or

yarn add -D @mediamonks/tawang

Usage

To use this plugin, you first have to require it. Secondly, you have to add an instance of it to the plugin array in the webpack.config.js. Finally, you have to pass the API endpoints to the options object. Alternatively, there is also a boilerplate project available here, which you can just clone.

webpack.config.js

const Tawang = require('@mediamonks/tawang');

module.exports = {
  // ...
  externals: {
    Animation: "commonjs Animation",
    Diagnostics: "commonjs Diagnostics",
    FaceTracking: "commonjs FaceTracking",
    Reactive: "commonjs Reactive",
    Scene: "commonjs Scene"
  },
  plugins: [
    new Tawang({
      serverHost: 'api.com',
      sourceMapEndpoint: '/source-map',
      parseEndpoint: '/source-map/[id]'
    })
  ]
}

Options

You have to pass the following options to the plugin.

serverHost: <String> (required)

The domain name of the API without the protocol (e.g. “https://”) and with the TLD (e.g. “.com”). Example: "api.com".

sourceMapEndpoint: <String> (optional)

The address of the source map POST endpoint relative to the serverHost domain. This is the address, where the plugin sends the source map during the compilation. Example: "/source-map".

parseEndpoint: <String> (optional)

The address of the parsing GET endpoint relative to the serverHost domain. Any errors which occur in the AR Studio script are sent here. The API server then parses the line and column number from the error and returns the code location in the original source. The URL should include placeholders for the source map id ("[id]"), line number ("[line]"), and column number ("[column]"). You have to enclose all placeholders in square brackets Example: "/source-map/[id]?line=[line]&column=[column]".

Example

This is an example webpack.config.js file with Babel support.

const webpack = require("webpack");
const path = require("path");
const Tawang = require('@mediamonks/tawang');

module.exports = {
  entry: "./src/script.js",
  mode: "production",
  devtool: "source-map",
  output: {
    path: "./build"),
    filename: "main.bundle.js"
  },
  module: {
    rules: [{
            test: /\.js$/,
            exclude: /(node_modules|bower_components)/,
            use: {
                loader: 'babel-loader',
                options: {
                    presets: ['env']
                }
            }
        }
    ]
  },
  externals: {
    Animation: "commonjs Animation",
    Diagnostics: "commonjs Diagnostics",
    FaceTracking: "commonjs FaceTracking",
    Reactive: "commonjs Reactive",
    Scene: "commonjs Scene"
  },
  plugins: [
    new Tawang({
      serverHost: 'api.com',
      sourceMapEndpoint: '/source-map',
      parseEndpoint: '/source-map/[id]?line=[line]&column=[column]'
    })
  ]
};