Coder Social home page Coder Social logo

opal-node-runtime's Introduction

Opal Runtime for Node.js

Travis build status npm version

Usage

var Opal = require('opal-runtime').Opal;
// Now let's have fun with Opal!

opal-node-runtime's People

Contributors

anthonny avatar dependabot-preview[bot] avatar dependabot[bot] avatar ggrossetie avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

opal-node-runtime's Issues

Attempted to assign to read-only property under Bun 0.1.8

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

opal-runtime seems to break Chai assertion on arrays

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?

Update to 0.10.1 release

Both 0.10.0 and 0.10.1 are now stable, and maybe it's better to have them available instead of integration releases.

method 'new' not defined in Object.Opal.udef

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.