Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict'
const fs = require('fs')
const path = require('path')
const bfs = require('bestikk-fs')
const log = require('bestikk-log')
const OpalBuilder = require('opal-compiler').Builder
const compileExt = (name, environment, skipped) => {
if (fs.existsSync(`lib/asciidoctor/js/${name}_ext/${environment}.rb`)) {
const module = `asciidoctor/js/${name}_ext/${environment}`
log.debug(module)
// Build a new instance each time, otherwise the context is shared.
const target = `build/${name}-ext-${environment}.js`
if (fs.existsSync(target)) {
skipped.push(target)
return
}
const opalBuilder = OpalBuilder.create()
opalBuilder.appendPaths('lib')
opalBuilder.setCompilerOptions({ dynamic_require_severity: 'ignore', requirable: true })
// For performance reason we build "asciidoctor_ext" without "asciidoctor" core.
// As a result Ruby modules required in "asciidoctor_ext" won't be found at compile time but will be resolved at runtime.
'use strict'
const path = require('path')
const fs = require('fs')
const log = require('bestikk-log')
const bfs = require('bestikk-fs')
const Download = require('bestikk-download')
const download = new Download({})
const OpalBuilder = require('opal-compiler').Builder
const BuilderModule = require('./module/builder')
const compileExamples = () => {
log.task('compile examples')
bfs.mkdirsSync(builder.examplesBuildDir)
const opalBuilder = OpalBuilder.create()
opalBuilder.appendPaths('build/asciidoctor/lib')
opalBuilder.appendPaths('node_modules/opal-compiler/src/stdlib')
opalBuilder.appendPaths('lib')
fs.writeFileSync(path.join(builder.examplesBuildDir, 'userguide_test.js'), opalBuilder.build('examples/userguide_test.rb').toString(), 'utf8')
}
const getContentFromAsciiDocRepo = (source, target) => {
return download.getContentFromURL(`${builder.asciidocRepoBaseURI}/doc/${source}`, target)
var log = require('bestikk-log');
var Builder = require('opal-compiler').Builder;
var fs = require('fs');
module.exports = OpalCompiler;
function OpalCompiler(config) {
this.config = config || {};
this.dynamicRequireLevel = this.config.dynamicRequireLevel || 'warning';
Opal.config.unsupported_features_severity = 'ignore';
}
OpalCompiler.prototype.compile = function(require, outputFile, includes) {
var builder = Builder.$new();
builder.$append_paths('node_modules/opal-compiler/src/stdlib', 'lib', 'build/asciidoctor/lib');
builder.compiler_options = Opal.hash({'dynamic_require_severity': this.dynamicRequireLevel});
if (typeof includes !== 'undefined') {
var includesLength = includes.length;