var Opal = require('opal-runtime').Opal;
// Now let's have fun with Opal!
ggrossetie / opal-node-runtime Goto Github PK
View Code? Open in Web Editor NEWOpal Runtime for Node.js
Home Page: https://opalrb.com/
License: MIT License
Opal Runtime for Node.js
Home Page: https://opalrb.com/
License: MIT License
I'm trying to get my application (AkashaCMS) to run on Bun - the new Node.js-compatible platform.
At this line of code:
const asciidoctor = require('@asciidoctor/core')();
I get this error:
$ bun filez.mjs
Config start
1861 | return Opal.send(this, body, args, block);
1862 | };
1863 |
1864 | // Try to make the browser pick the right name
1865 | alias.displayName = name;
1866 | alias.length = body.length;
^
TypeError: Attempted to assign to readonly property.
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/asciidoctor-opal-runtime/src/opal.js:1866:4
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/asciidoctor-opal-runtime/src/opal.js:2806:4
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/asciidoctor-opal-runtime/src/opal.js:2311:6
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/asciidoctor-opal-runtime/src/opal.js:5466:2
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/asciidoctor-opal-runtime/src/opal.js:2311:6
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/asciidoctor-opal-runtime/src/opal.js:20066:2
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/asciidoctor-opal-runtime/src/opal.js:20075:44
at bun:wrap:1:16354
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/asciidoctor-opal-runtime/src/index.js:23:10
at bun:wrap:1:16354
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/@asciidoctor/core/dist/node/asciidoctor.js:2:21
at bun:wrap:1:16354
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/akasharender/render-asciidoc.js:26:28
at bun:wrap:1:16354
at /home/david/Projects/akasharender/akashacms-perftest/node_modules/akasharender/index.js:177:42
at bun:wrap:1:16354
at /home/david/Projects/akasharender/akashacms-perftest/bench/config.mjs:6:0
It's relatively small and can be useful: https://github.com/opal/opal/blob/master/stdlib/erb.rb
Hi Guillaume,
I noticed when I load the opal-runtime some assertions of the Chai testing framework break. Because of changes you made on the standard Array object prototype, I assumed.
Anyway, I submitted an issue on the Chai project: chaijs/chai#1153
Could you check if you observe the same behavior, or if this is just something weird on my system?
Both 0.10.0
and 0.10.1
are now stable, and maybe it's better to have them available instead of integration releases.
This happens on codesandbox.io as well as on https://npm.runkit.com/opal-runtime (linked to by the NPM page)
This issue is pretty arcane - so please bear with me. Any ideas you have will be appreciated.
I'm building an Electron app that is using Vue.js and therefore behind the scenes Webpack is used.
Included in the code is a toolset that uses Asciidoctor.js, which in turn uses Opal-Runtime.
Outside the Electron app it (the toolset that eventually uses Opal Runtime) works fine -- and if I don't try to configure Webpack, then the app builds and runs fine. However, I am trying to solve some other issues and it was recommended to use this Webpack config (in vue.config.js
). The idea is that any Node module listed in the externals
array is not handled by Webpack.
module.exports = {
pluginOptions: {
electronBuilder: {
// List native deps here if they don't work
externals: ['@akashacms/plugins-epub', 'akasharender', 'mahabhuta',
'cheerio', 'opal-runtime', 'asciidoctor.js', 'cachd', 'cmnd',
'debug', 'ejs', 'fast-memoize', 'flat-cache', 'fs-extra', 'glob-fs',
'gray-matter', 'less', 'markdown-it', 'oembetter', 'rss', 'run-parallel-limit'],
// If you are using Yarn Workspaces, you may have multiple node_modules folders
// List them all here so that VCP Electron Builder can find them
nodeModulesPath: ['../../node_modules', './node_modules']
}
}
}
As per instructions here: https://nklayman.github.io/vue-cli-plugin-electron-builder/guide/guide.html#native-modules
But when I have this config in place, this error arises:
App threw an error during load
method 'new' not defined in
at Object.Opal.udef (webpack:///./node_modules/opal-runtime/src/opal.js?:1784:28)
at eval (webpack:///./node_modules/opal-runtime/src/opal.js?:6225:12)
at eval (webpack:///./node_modules/opal-runtime/src/opal.js?:6227:7)
at Opal.modules.corelib/boolean (webpack:///./node_modules/opal-runtime/src/opal.js?:6302:5)
at Object.Opal.load (webpack:///./node_modules/opal-runtime/src/opal.js?:2300:7)
at $Object.Opal.require (webpack:///./node_modules/opal-runtime/src/opal.js?:2328:17)
at Opal.modules.opal/mini (webpack:///./node_modules/opal-runtime/src/opal.js?:18607:8)
at Object.Opal.load (webpack:///./node_modules/opal-runtime/src/opal.js?:2300:7)
at $Object.Opal.require (webpack:///./node_modules/opal-runtime/src/opal.js?:2328:17)
at eval (webpack:///./node_modules/opal-runtime/src/opal.js?:23338:8)
If I rename the webpack config to e.g. vue.config.non-js
(so it's not recognized) then the app loads without problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.