Giter VIP home page Giter VIP logo

Comments (10)

icarito avatar icarito commented on May 19, 2024

Also I think related to this is support for export default syntax.
The question is how to implement it? If __all__ is not a list, perhaps?

from metapensiero.pj.

azazel75 avatar azazel75 commented on May 19, 2024

so the function/class is accessible at vue.Vue?

the standard Python's:

from vue import Vue 

should work in that case or

import vue as Vue

if it's a default import:

$ pj -s -
from vue import Vue
import vue as Vue 

import {Vue} from 'vue';
import * as Vue from 'vue';

About the default exports, I simply don't think it's much of a feature.. anywayI've thought about using all too, but doesn't seem right...

from metapensiero.pj.

icarito avatar icarito commented on May 19, 2024

I had tried that and I couldn't get it to work but now I learned it was because of an issue with Webpack and module loading webpack/webpack#4039 - apparently you can't mix import and module.exports so it's a small but important feature.

from metapensiero.pj.

icarito avatar icarito commented on May 19, 2024

I guess import {Vue} from 'vue' is different from import Vue from 'vue'.
I was able to get the behaviour I need with from vue import default as Vue:

<script lang="py?compiler=pj">
from vue import default as Vue
from vue__codemirror__lite import default as VueCodeMirror

Vue.use(VueCodeMirror)

class Component:
    def __init__(self):
        self['data'] = lambda: { 'code': '2' }
        self['computed'] = { 'data': lambda: 2 }

__all__ = Component()
</script>

from metapensiero.pj.

icarito avatar icarito commented on May 19, 2024

That is after applying patch for default export.

from metapensiero.pj.

azazel75 avatar azazel75 commented on May 19, 2024

I was wrong, this should be the "non obvious" default import using named imports:

import {default as bar} from 'foo';

from metapensiero.pj.

azazel75 avatar azazel75 commented on May 19, 2024

@icarito Please see the referenced commit and see if it now works for you!

from metapensiero.pj.

azazel75 avatar azazel75 commented on May 19, 2024

I still have to update the docs

from metapensiero.pj.

icarito avatar icarito commented on May 19, 2024

Thanks for your updates! Also I suggest to implement anonymous default export as in https://gitlab.com/metapensiero/metapensiero.pj/merge_requests/35

from metapensiero.pj.

azazel75 avatar azazel75 commented on May 19, 2024

Hi @icarito, I'm closing this. It seems superseded by the changes in the repo. Open a new one for any remaining issues. Also note that i've made a new release, so you don't have to refer directly to a snapshot of the repo in your requirements.txt

from metapensiero.pj.

Related Issues (20)

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.