How to use the buble.transform function in buble

To help you get started, we’ve selected a few buble 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 peterqliu / threebox / node_modules / acorn-node / build.js View on Github external
function compile (name, output) { // eslint-disable-line no-unused-vars
  console.log(name, '→', output)
  mkdirp.sync(path.dirname(path.join(__dirname, output)))
  var source = fs.readFileSync(require.resolve(name), 'utf8')
  var result = buble.transform(source, {
    transforms: {
      dangerousForOf: true
    }
  })
  fs.writeFileSync(path.join(__dirname, output), HEADER + result.code, 'utf8')
}
github jeromeetienne / qrcode-reader / tmp / instascan-dir / instascan / node_modules / acorn-node / build.js View on Github external
function compile (name, output) { // eslint-disable-line no-unused-vars
  console.log(name, '→', output)
  mkdirp.sync(path.dirname(path.join(__dirname, output)))
  var source = fs.readFileSync(require.resolve(name), 'utf8')
  var result = buble.transform(source, {
    transforms: {
      dangerousForOf: true
    }
  })
  fs.writeFileSync(path.join(__dirname, output), HEADER + result.code, 'utf8')
}
github oceanofthelost / InteractiveBOM / GUI / node_modules / acorn-node / build.js View on Github external
function compile (name, output) { // eslint-disable-line no-unused-vars
  console.log(name, '→', output)
  mkdirp.sync(path.dirname(path.join(__dirname, output)))
  var source = fs.readFileSync(require.resolve(name), 'utf8')
  var result = buble.transform(source, {
    transforms: {
      dangerousForOf: true
    }
  })
  fs.writeFileSync(path.join(__dirname, output), HEADER + result.code, 'utf8')
}
github davidbonnet / astring / scripts / benchmark.js View on Github external
.add('acorn + buble', () => {
      buble(code, bubleOptions).code
    })
    // add listeners
github rollup / rollup / test / sourcemaps / transforms / _config.js View on Github external
transform: function ( source, id ) {
					return buble.transform( source, {
						transforms: { modules: false }
					});
				}
			},
github rollup / rollup / test / sourcemaps / samples / transforms / _config.js View on Github external
transform(source, id) {
					return buble.transform(source, {
						transforms: { modules: false }
					});
				}
			},
github rollup / rollup / test / function / index.js View on Github external
.then(() => {
							if (unintendedError) throw unintendedError;
							if (config.error || config.generateError) return;

							if (config.buble) {
								for (const chunk of result) {
									if (chunk.code) {
										chunk.code = buble.transform(chunk.code, {
											transforms: { modules: false }
										}).code;
									}
								}
							}

							const codeMap = result.reduce((codeMap, chunk) => {
								codeMap[chunk.fileName] = chunk.code;
								return codeMap;
							}, {});
							if (config.code) {
								config.code(result.length === 1 ? result[0].code : codeMap);
							}

							const entryId = result.length === 1 ? result[0].fileName : 'main.js';
							if (!codeMap.hasOwnProperty(entryId)) {
github fuzetsu / mergerino / build.js View on Github external
const moduleToBrowser = code =>
  umdBoiler.replace(
    '{{CODE}}',
    code
      .replace(/export\s+(const|let|var)\s+([^\s]+)/gi, '$1 $2 = exports.$2')
      .replace(/export\s+\{([^}]+)\}/, (_, names) =>
        names
          .split(',')
          .map(name => `exports.${name} = ${name}`)
          .join('\n')
      )
      .replace(/export\s+default\s+([^\s]+)/gi, 'exports = assign($1, exports)')
      .replace(/^/gm, '  ')
  )

const bubleOut = buble.transform(moduleToBrowser(input), {
  modules: false,
  transforms: { dangerousForOf: true }
})
const bubleTerserOut = Terser.minify(
  { [es5SrcName]: bubleOut.code },
  { ecma: 5, sourceMap: { filename: es5OutName, url: es5OutName + '.map' } }
)

const reportDiff = (path, newCode) => {
  if (!fss.existsSync(path)) return
  const beforeSize = fss.statSync(path).size
  const beforeGzip = zlib.gzipSync(fss.readFileSync(path)).byteLength
  const afterSize = newCode.length
  const afterGzip = zlib.gzipSync(Buffer.from(newCode, 'utf-8')).byteLength
  console.log(
    [
github cloudflare / ipfs-ext / node_modules / acorn-node / build.js View on Github external
function compile (name, output, fix) {
  console.log(name, '→', output)
  mkdirp.sync(path.dirname(path.join(__dirname, output)))
  var source = fs.readFileSync(require.resolve(name), 'utf8')
  if (fix) source = fix(source)
  var result = buble.transform(source, {
    transforms: {
      dangerousForOf: true
    }
  })
  fs.writeFileSync(path.join(__dirname, output), HEADER + result.code, 'utf8')
}
github publiclab / leaflet-environmental-layers / node_modules / acorn-node / build.js View on Github external
function compile (name, output, fix) {
  console.log(name, '→', output)
  mkdirp.sync(path.dirname(path.join(__dirname, output)))
  var source = fs.readFileSync(require.resolve(name), 'utf8')
  if (fix) source = fix(source)
  var result = buble.transform(source, {
    transforms: {
      dangerousForOf: true
    }
  })
  fs.writeFileSync(path.join(__dirname, output), HEADER + result.code, 'utf8')
}

buble

The blazing fast, batteries-included ES2015 compiler

MIT
Latest version published 5 years ago

Package Health Score

59 / 100
Full package analysis

Popular buble functions