Skip to content

Commit 833e4b4

Browse files
fix: relative node_modules access
1 parent d94dae2 commit 833e4b4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/core/tasks/module/builder.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ const generateFlavors = async (asciidoctorCoreTarget, environments) => {
124124

125125
const packageJson = require('../../package.json')
126126
const templateModel = {
127-
'//{{opalCode}}': fs.readFileSync('node_modules/@asciidoctor/opal-runtime/src/opal.js', 'utf8'),
127+
'//{{opalCode}}': fs.readFileSync('../../node_modules/@asciidoctor/opal-runtime/src/opal.js', 'utf8'),
128128
'//{{asciidoctorAPI}}': fs.readFileSync(apiBundle, 'utf8'),
129129
'//{{asciidoctorVersion}}': `var ASCIIDOCTOR_JS_VERSION = '${packageJson.version}';`
130130
}

packages/core/tasks/module/compiler.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const compileAsciidoctorCore = (asciidoctorCoreDependency) => {
6363
// end::asciidoctor#4205
6464
const opalBuilder = require('opal-compiler').Builder.create()
6565
opalBuilder.appendPaths('build/asciidoctor/lib')
66-
opalBuilder.appendPaths('node_modules/opal-compiler/src/stdlib')
66+
opalBuilder.appendPaths('../../node_modules/opal-compiler/src/stdlib')
6767
opalBuilder.appendPaths('lib')
6868
opalBuilder.setCompilerOptions({ dynamic_require_severity: 'ignore', use_strict: true })
6969
fs.writeFileSync(target, opalBuilder.build('asciidoctor').toString(), 'utf8')
@@ -93,7 +93,7 @@ const applyPatches = (asciidoctorCoreDependency) => {
9393
const patchOpalCompiler = () => {
9494
// revert https://github.com/opal/opal/commit/d46792d2160e4f524c3add711f6424dd99187d1c
9595
// see: https://github.com/opal/opal/issues/2099
96-
const sourceFile = path.join(__dirname, '..', '..', 'node_modules', 'opal-compiler', 'src', 'opal-builder.js')
96+
const sourceFile = path.join(__dirname, '..', '..', '..', '..', 'node_modules', 'opal-compiler', 'src', 'opal-builder.js')
9797
const source = fs.readFileSync(sourceFile, 'utf8')
9898
fs.writeFileSync(sourceFile, source.replace(/(Opal\.modules\["opal\/parser\/patch"].*?)(\s+\(function\([^)]+\) {\n\s+var self = \$klass\(\$base, \$super, 'Lexer'\);.*},\s\$Lexer_source_buffer\$eq\$1\.\$\$arity = 1\), nil\) && 'source_buffer='\n\s+}\)\(\$\$\(\$nesting, 'Parser'\), null, \$nesting\);)/gs, '$1'))
9999
}

0 commit comments

Comments
 (0)