build-system/babel-plugins/babel-plugin-transform-jss/index.js
// Abuses spawnSync to let us run an async function sync.
Abuses spawnSync to let us run an async function sync.
Abuses spawnSync to let us run an async function sync .
function transformCssSync(cssText) {
  const programText = `
    const {transformCss} = require('../../../build-system/tasks/jsify-css');
    transformCss(\`${cssText}\`).then((css) => console./* OK */log(css.toString()));
  `;
  const spawnedProcess = spawnSync('node', ['-e', programText], {
    cwd: __dirname,
    env: process.env,
    encoding: 'utf-8',
    stdio: 'pipe',
  });
  if (spawnedProcess.status !== 0) {
    throw new Error(
      `Transforming CSS returned status code: ${spawnedProcess.status}. stderr: "${spawnedProcess.stderr}".`
    );
  }
  return spawnedProcess.stdout;
}
function transformCssSync ( cssText ) { const programText = ` \` ${ cssText } \` ` ; const spawnedProcess = spawnSync ( 'node' , [ '-e' , programText ] , { cwd : __dirname , env : process . env , encoding : 'utf-8' , stdio : 'pipe' , } ) ; if ( spawnedProcess . status !== 0 ) { throw new Error ( ` ${ spawnedProcess . status } ${ spawnedProcess . stderr } ` ) ; } return spawnedProcess . stdout ; }
Abuses spawnSync to let us run an async function sync.
Abuses spawnSync to let us run an async function sync .
// TODO: migrate to the helpers in build-system exec.js // after adding args support.