How to use haxe-modular - 2 common examples

To help you get started, we’ve selected a few haxe-modular 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 jasononeil / webpack-haxe-loader / index.js View on Github external
function processOutput(ns, jsTempFile, jsOutputFile, options) {
    const content = fs.readFileSync(jsTempFile.path);
    // Check whether the output has changed since last build
    const contentHash = hash(content);
    if (cache[ns] && cache[ns].hash === contentHash) return null;
    // Split output
    const modules = findImports(content);
    const sourcemaps = fs.existsSync(`${jsTempFile.path}.map`);
    const sizeReport = !!options.sizeReport;
    const results = split
        .run(
            jsTempFile.path,
            jsOutputFile,
            modules,
            sourcemaps,
            true /* commonjs - required */,
            false /* debug sourcemap - unsupported*/,
            sizeReport,
            graphHooks
        )
        .filter(entry => entry && entry.source);

    // Inject .hx sources in map file
    results.forEach(entry => {
        if (entry.map) {
            const map = entry.map.content;
github jasononeil / webpack-haxe-loader / index.js View on Github external
const fs = require('fs');
const path = require('path');
const exec = require('child_process').exec;
const tmp = require('tmp');
const hash = require('hash-sum');
const split = require('haxe-modular/tool/bin/split');
const hooks = require('haxe-modular/bin/hooks');
const tokenize = require('yargs-parser/lib/tokenize-arg-string');

const haxeErrorParser = require('haxe-error-parser');
const problemMatcher = haxeErrorParser.problemMatcher;
const identifyError = haxeErrorParser.identifyError;

const cache = Object.create(null);
// resolve hooks once
const graphHooks = hooks.getGraphHooks();

module.exports = function(hxmlContent) {
    const context = this;
    const options = loaderUtils.getOptions(context) || {};
    context.cacheable && context.cacheable();
    const cb = context.async();

    const request = context.resourcePath;
    if (!request) {
        // Loader was called without specifying a hxml file
        // Expecting a require of the form '!haxe-loader?hxmlName/moduleName!'
        fromCache(context, context.query, cb);
        return;
    }

    const ns = path.basename(request).replace('.hxml', '');

haxe-modular

[![TravisCI Build Status](https://travis-ci.org/elsassph/haxe-modular.svg?branch=master)](https://travis-ci.org/elsassph/haxe-modular) [![Haxelib Version](https://img.shields.io/github/tag/elsassph/haxe-modular.svg?label=haxelib)](http://lib.haxe.org/p/mo

ISC
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Similar packages