Skip to content

Conversation

wesgarland
Copy link
Collaborator

Initial (working) stab at a commonjs module system

@wesgarland wesgarland changed the base branch from BF-14 to BF-38 May 27, 2023 03:00
Wes Garland and others added 27 commits May 27, 2023 10:31
…deprecate debugPrint in favour of python.print
…ter managed python.load to give exports as dict
The input string contains the newline character `\n` , but the regex doesn't match across multiple lines
If a VCS is being used for a package, Poetry exclude field will be seeded with the VCS’ ignore settings (.gitignore for git for example).
@Hamada-Distributed Hamada-Distributed self-requested a review June 26, 2023 20:26
Copy link
Contributor

@Hamada-Distributed Hamada-Distributed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just have one comment, will approve right after!

@wiwichips
Copy link
Collaborator

wiwichips commented Jun 27, 2023

FWIW I got a couple seg faults while playing around with require


Example:

folder structure output from tree

.
├── main.py
└── node_modules
    ├── a
    │   └── index.js
    └── b
        └── index.js

main.py

#!/usr/bin/env python3

import pythonmonkey as pm
require = pm.createRequire(__file__)

print(require("a"))

a/index.js

module.exports = require("b");

b/index.js

module.exports = "Hello from B";

Below is my output from running main.py

./main.py 
Segmentation fault (core dumped)

It would be awesome to get this working so we could have some simple npm packages working like the infamous is-odd which requires is-number for instance (but otherwise works fine in PM without this specific issue)

@wesgarland
Copy link
Collaborator Author

As far as I know, this branch is now ready to merge, except that it entrains PR37 and PR57, which aren't.

Base automatically changed from BF-38 to main July 4, 2023 15:54
@Xmader
Copy link
Member

Xmader commented Jul 4, 2023

FWIW I got a couple seg faults while playing around with require

@wiwichips It's confirmed been fixed on the latest wes/module-system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants