How to use the parcel-bundler/src/Logger.progress function in parcel-bundler

To help you get started, we’ve selected a few parcel-bundler 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 QQuick / Transcrypt / parcel / asset.js View on Github external
let config = Object.assign({}, DEFAULT_PACKAGE_CONFIG["parcel-plugin-python"], pkgConfig["parcel-plugin-python"]);

        // run transcrypt
        let cmd = [
            config['command'],                              // python3 -m transcrypt
            ...config['arguments'],                         // --map --nomin --build ...
            '"' + this.pyModule.replace('"', '\\"') + '"'   // main file using dotted notation
        ].join(' ');
        let cmd_options = {
            // we need to call python from the root project dir so the __target__ location
            // stays the same for all .py files in the run. This allows them to share the
            // same __runtime__ and thus a common "memory" space.
            'cwd': this.options.rootDir,
            'encoding': 'utf8',
        };
        logger.progress(`${LOG_PREFIX} ${cmd}`);
        try {
            let stdout = child_process.execSync(cmd, cmd_options).toString();
        } catch (err) {
            logger.error(`${LOG_PREFIX} Error compiling ${this.name}\n${err.stdout.toString()}`);
            throw err;
        } //try
        logger.clear();

        // we now have a __target__ directory with our .py -> .js, plus all its
        // dependencies. instead of reading it in here, we create an intermediary
        // script to bridge the __target__ files into this location.
        // this is a hack around the difference in the way parcel and transcrypt
        // work. when parcel calls this Asset class, it sees all imports as relative
        // to the source .py file directory, not the __target__ directory. that means
        // all the dependencies transcrypt sends to __target__ are in the wrong directory.
        // i tried doing multiple calls to transcrypt, custom JSAsset classes, moving the