From e790de3ec5fd0b91ddc5bb8d06b9313893e41250 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Tue, 27 Jun 2023 05:38:04 +0000 Subject: [PATCH 01/28] chore: update package-lock.json to use lockfileVersion 2 --- python/pminit/pythonmonkey/package-lock.json | 500 ++++++++++++++++++- 1 file changed, 499 insertions(+), 1 deletion(-) diff --git a/python/pminit/pythonmonkey/package-lock.json b/python/pminit/pythonmonkey/package-lock.json index 58f8278c..36fc56fe 100644 --- a/python/pminit/pythonmonkey/package-lock.json +++ b/python/pminit/pythonmonkey/package-lock.json @@ -1,8 +1,506 @@ { "name": "pythonmonkey", "version": "0.0.1", - "lockfileVersion": 1, + "lockfileVersion": 2, "requires": true, + "packages": { + "": { + "name": "pythonmonkey", + "version": "0.0.1", + "license": "MIT", + "dependencies": { + "ctx-module": "^1.0.12" + } + }, + "node_modules/asn1.js": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", + "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "safer-buffer": "^2.1.0" + } + }, + "node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "node_modules/browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dependencies": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/browserify-rsa": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", + "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", + "dependencies": { + "bn.js": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "node_modules/browserify-sign": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", + "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", + "dependencies": { + "bn.js": "^5.1.1", + "browserify-rsa": "^4.0.1", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.3", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.5", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==" + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/create-ecdh": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", + "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "dependencies": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "node_modules/create-ecdh/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dependencies": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ctx-module": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/ctx-module/-/ctx-module-1.0.12.tgz", + "integrity": "sha512-iaple0ZSdEOq5Wdx7/eh6VvVZ5Rm4IICzvEulDiXXER+eGMgUlaPBBPZsV3aPhyy5LJNVwA4pKSqc0hIBvP0sA==", + "dependencies": { + "buffer": "^6.0.3", + "crypto-browserify": "^3.12.0" + } + }, + "node_modules/des.js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.1.0.tgz", + "integrity": "sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==", + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/diffie-hellman": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dependencies": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "node_modules/diffie-hellman/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dependencies": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" + } + }, + "node_modules/miller-rabin/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, + "node_modules/parse-asn1": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", + "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", + "dependencies": { + "asn1.js": "^5.2.0", + "browserify-aes": "^1.0.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", + "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/public-encrypt": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", + "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", + "dependencies": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/public-encrypt/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" + }, + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + } + }, "dependencies": { "asn1.js": { "version": "5.4.1", From b9b8507c7c9027b3cd06ad75c0389db88a3b0233 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 19 Jul 2023 00:02:01 +0000 Subject: [PATCH 02/28] feat(pmpm): write our own minimum copy of npm in Python to remove the requirement for Node.js npm --- README.md | 1 - python/pminit/pmpm.py | 72 ++++++++++++++++++++++++++++++ python/pminit/post-install-hook.py | 17 +------ 3 files changed, 74 insertions(+), 16 deletions(-) create mode 100644 python/pminit/pmpm.py diff --git a/README.md b/README.md index 450a38da..784ae4ba 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,6 @@ Read this if you want to build a local version. - rust - python3.8 or later with header files (python3-dev) - spidermonkey 102.2.0 or later - - npm (nodejs) - [Poetry](https://python-poetry.org/docs/#installation) - [poetry-dynamic-versioning](https://github.com/mtkennerly/poetry-dynamic-versioning) diff --git a/python/pminit/pmpm.py b/python/pminit/pmpm.py new file mode 100644 index 00000000..d9986b7f --- /dev/null +++ b/python/pminit/pmpm.py @@ -0,0 +1,72 @@ +# @file pmpm.py +# A minimum copy of npm written in pure Python. +# Currently, this can only install dependencies specified by package-lock.json into node_modules. +# @author Tom Tang +# @date July 2023 + +import json +import io +import os, shutil +import tempfile +import tarfile +from dataclasses import dataclass +import urllib.request +from typing import List, Union + +WORK_DIR = os.path.join( + os.path.realpath(os.path.dirname(__file__)), + "pythonmonkey" +) + +@dataclass +class PackageItem: + installation_path: str + tarball_url: str + has_install_script: bool + +def parse_package_lock_json(json_data: Union[str, bytes]) -> List[PackageItem]: + # See https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-json#packages + packages: dict = json.loads(json_data)["packages"] + items: List[PackageItem] = [] + for key, entry in packages.items(): + if key == "": + # Skip the root project (listed with a key of "") + continue + items.append( + PackageItem( + installation_path=key, # relative path from the root project folder + # The path is flattened for nested node_modules, e.g., "node_modules/create-ecdh/node_modules/bn.js" + tarball_url=entry["resolved"], # TODO: handle git dependencies + has_install_script=entry.get("hasInstallScript", False) # the package has a preinstall, install, or postinstall script + ) + ) + return items + +def download_package(tarball_url: str) -> bytes: + with urllib.request.urlopen(tarball_url) as response: + tarball_data: bytes = response.read() + return tarball_data + +def unpack_package(installation_path: str, tarball_data: bytes): + installation_path = os.path.join(WORK_DIR, installation_path) + shutil.rmtree(installation_path, ignore_errors=True) + + with tempfile.TemporaryDirectory(prefix="pmpm_cache-") as tmpdir: + with io.BytesIO(tarball_data) as tar_file: + with tarfile.open(fileobj=tar_file) as tar: + tar.extractall(tmpdir) + shutil.move( + os.path.join(tmpdir, "package"), # Strip the root folder + installation_path + ) + +def main(): + with open(os.path.join(WORK_DIR, "package-lock.json"), encoding="utf-8") as f: + items = parse_package_lock_json(f.read()) + for i in items: + print("Installing " + i.installation_path) + tarball_data = download_package(i.tarball_url) + unpack_package(i.installation_path, tarball_data) + +if __name__ == "__main__": + main() diff --git a/python/pminit/post-install-hook.py b/python/pminit/post-install-hook.py index 52f1e423..390f81c4 100644 --- a/python/pminit/post-install-hook.py +++ b/python/pminit/post-install-hook.py @@ -1,20 +1,7 @@ -import subprocess -import sys - -def execute(cmd: str): - popen = subprocess.Popen(cmd, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, - shell = True, text = True ) - for stdout_line in iter(popen.stdout.readline, ""): - sys.stdout.write(stdout_line) - sys.stdout.flush() - - popen.stdout.close() - return_code = popen.wait() - if return_code: - raise subprocess.CalledProcessError(return_code, cmd) +import pmpm def main(): - execute("cd pythonmonkey && npm i --no-package-lock") # do not update package-lock.json + pmpm.main() # cd pythonmonkey && npm i if __name__ == "__main__": main() From 0e0d15d40a1f8163dcaf20ca105bdfd7afac974e Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 19 Jul 2023 00:08:06 +0000 Subject: [PATCH 03/28] fix(pmpm): import path for post-install-hook --- python/pminit/post-install-hook.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pminit/post-install-hook.py b/python/pminit/post-install-hook.py index 390f81c4..58deb01e 100644 --- a/python/pminit/post-install-hook.py +++ b/python/pminit/post-install-hook.py @@ -1,4 +1,4 @@ -import pmpm +from . import pmpm def main(): pmpm.main() # cd pythonmonkey && npm i From c868ff4249f888b96d5aecd3c5915456f286a66a Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 8 May 2024 20:13:42 +0000 Subject: [PATCH 04/28] refactor(pmpm): support any abstract working directory --- python/pminit/pmpm.py | 17 ++++++----------- python/pminit/post-install-hook.py | 8 +++++++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/python/pminit/pmpm.py b/python/pminit/pmpm.py index d9986b7f..59a78a14 100644 --- a/python/pminit/pmpm.py +++ b/python/pminit/pmpm.py @@ -13,11 +13,6 @@ import urllib.request from typing import List, Union -WORK_DIR = os.path.join( - os.path.realpath(os.path.dirname(__file__)), - "pythonmonkey" -) - @dataclass class PackageItem: installation_path: str @@ -47,8 +42,8 @@ def download_package(tarball_url: str) -> bytes: tarball_data: bytes = response.read() return tarball_data -def unpack_package(installation_path: str, tarball_data: bytes): - installation_path = os.path.join(WORK_DIR, installation_path) +def unpack_package(work_dir:str, installation_path: str, tarball_data: bytes): + installation_path = os.path.join(work_dir, installation_path) shutil.rmtree(installation_path, ignore_errors=True) with tempfile.TemporaryDirectory(prefix="pmpm_cache-") as tmpdir: @@ -60,13 +55,13 @@ def unpack_package(installation_path: str, tarball_data: bytes): installation_path ) -def main(): - with open(os.path.join(WORK_DIR, "package-lock.json"), encoding="utf-8") as f: +def main(work_dir: str): + with open(os.path.join(work_dir, "package-lock.json"), encoding="utf-8") as f: items = parse_package_lock_json(f.read()) for i in items: print("Installing " + i.installation_path) tarball_data = download_package(i.tarball_url) - unpack_package(i.installation_path, tarball_data) + unpack_package(work_dir, i.installation_path, tarball_data) if __name__ == "__main__": - main() + main(os.getcwd()) diff --git a/python/pminit/post-install-hook.py b/python/pminit/post-install-hook.py index 58deb01e..36256974 100644 --- a/python/pminit/post-install-hook.py +++ b/python/pminit/post-install-hook.py @@ -1,7 +1,13 @@ +import os from . import pmpm +WORK_DIR = os.path.join( + os.path.realpath(os.path.dirname(__file__)), + "pythonmonkey" +) + def main(): - pmpm.main() # cd pythonmonkey && npm i + pmpm.main(WORK_DIR) # cd pythonmonkey && npm i if __name__ == "__main__": main() From fb4b0af66a4ca7254903c2198e22c4144af0e87a Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 8 May 2024 20:35:55 +0000 Subject: [PATCH 05/28] fix(pmpm): import pmpm for post-install-hook --- python/pminit/post-install-hook.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/python/pminit/post-install-hook.py b/python/pminit/post-install-hook.py index 36256974..bf6ed7ab 100644 --- a/python/pminit/post-install-hook.py +++ b/python/pminit/post-install-hook.py @@ -1,13 +1,28 @@ import os -from . import pmpm +import sys +import importlib +import importlib.util WORK_DIR = os.path.join( - os.path.realpath(os.path.dirname(__file__)), - "pythonmonkey" + os.path.realpath(os.path.dirname(__file__)), + "pythonmonkey" ) +def import_file(module_name: str, file_path: str): + """ + Import a Python file from its relative path directly. + + See https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly + """ + spec = importlib.util.spec_from_file_location(module_name, file_path) + module = importlib.util.module_from_spec(spec) # type: ignore + sys.modules[module_name] = module + spec.loader.exec_module(module) # type: ignore + return module + def main(): - pmpm.main(WORK_DIR) # cd pythonmonkey && npm i + pmpm = import_file("pmpm", os.path.join(os.path.dirname(__file__), "./pmpm.py")) # from . import pmpm + pmpm.main(WORK_DIR) # cd pythonmonkey && npm i if __name__ == "__main__": - main() + main() From 2b99eebdd172941f3a3b86e0647acef2f0f7e1d4 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 8 May 2024 20:50:13 +0000 Subject: [PATCH 06/28] fix(pmpm): fix importing pmpm for post-install-hook --- python/pminit/post-install-hook.py | 17 +---------------- python/pminit/pyproject.toml | 1 + 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/python/pminit/post-install-hook.py b/python/pminit/post-install-hook.py index bf6ed7ab..061492c1 100644 --- a/python/pminit/post-install-hook.py +++ b/python/pminit/post-install-hook.py @@ -1,27 +1,12 @@ import os -import sys -import importlib -import importlib.util +import pmpm WORK_DIR = os.path.join( os.path.realpath(os.path.dirname(__file__)), "pythonmonkey" ) -def import_file(module_name: str, file_path: str): - """ - Import a Python file from its relative path directly. - - See https://docs.python.org/3/library/importlib.html#importing-a-source-file-directly - """ - spec = importlib.util.spec_from_file_location(module_name, file_path) - module = importlib.util.module_from_spec(spec) # type: ignore - sys.modules[module_name] = module - spec.loader.exec_module(module) # type: ignore - return module - def main(): - pmpm = import_file("pmpm", os.path.join(os.path.dirname(__file__), "./pmpm.py")) # from . import pmpm pmpm.main(WORK_DIR) # cd pythonmonkey && npm i if __name__ == "__main__": diff --git a/python/pminit/pyproject.toml b/python/pminit/pyproject.toml index 9910cc72..31dce5b7 100644 --- a/python/pminit/pyproject.toml +++ b/python/pminit/pyproject.toml @@ -9,6 +9,7 @@ authors = [ "Hamada Gasmallah " ] include = [ + "pmpm.py", # Install extra files into the pythonmonkey package "pythonmonkey/package*.json", { path = "pythonmonkey/node_modules/**/*", format = "wheel" }, From 2a3a4477ec723af47388b1b27a30748a125c3e56 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 16:30:18 +0000 Subject: [PATCH 07/28] feat(CI): use a Ubuntu 20.04 container to build --- .github/workflows/test-and-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index ab83885a..05800aed 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -69,6 +69,7 @@ jobs: # see https://github.blog/changelog/2024-01-30-github-actions-macos-14-sonoma-is-now-available python_version: [ '3.10' ] runs-on: ${{ matrix.os }} + container: ${{ (matrix.os == 'ubuntu-22.04' && 'ubuntu:20.04') || null }} # Use the Ubuntu 20.04 container inside Ubuntu 22.04 runner to build steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 From 0002a6da558de059a4b840bd0fc7e994b2aaecb2 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 16:34:10 +0000 Subject: [PATCH 08/28] fix(CI): run apt update in the container --- .github/workflows/test-and-publish.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 05800aed..173aa005 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -85,6 +85,8 @@ jobs: ./_spidermonkey_install/* key: spidermonkey-${{ env.MOZCENTRAL_VERSION }}-${{ runner.os }}-${{ runner.arch }} lookup-only: true # skip download + - if: ${{ matrix.os == 'ubuntu-22.04' }} + run: sudo apt-get update -y - name: Setup XCode if: ${{ matrix.os == 'macos-13' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }} # SpiderMonkey requires XCode SDK version at least 13.3 From 931a51e7115b209343799067e29a6dc62e52bd54 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 12:39:29 -0400 Subject: [PATCH 09/28] fix(CI): conatiner apt update --- .github/workflows/test-and-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 173aa005..8c4ed963 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -86,7 +86,7 @@ jobs: key: spidermonkey-${{ env.MOZCENTRAL_VERSION }}-${{ runner.os }}-${{ runner.arch }} lookup-only: true # skip download - if: ${{ matrix.os == 'ubuntu-22.04' }} - run: sudo apt-get update -y + run: apt-get update -y && apt-get install -y sudo - name: Setup XCode if: ${{ matrix.os == 'macos-13' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }} # SpiderMonkey requires XCode SDK version at least 13.3 From e4821ec39d10eeddc1254f17305749f5f269c2c5 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 12:48:19 -0400 Subject: [PATCH 10/28] fix(CI): `apt-get` should run in noninteractive mode See https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive --- .github/workflows/test-and-publish.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 8c4ed963..4100476d 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -49,6 +49,8 @@ env: # don't upgrade outdated brew packages because the process is too slow HOMEBREW_NO_INSTALL_UPGRADE: 1 HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 + # apt-get should run in noninteractive mode + DEBIAN_FRONTEND: noninteractive defaults: run: From ce0249ca9d18c4e1d77cb116e126bd57f447d970 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 12:51:40 -0400 Subject: [PATCH 11/28] feat(CI): use the Ubuntu 20.04 container to build PythonMonkey itself --- .github/workflows/test-and-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 4100476d..33f96714 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -140,6 +140,7 @@ jobs: os: [ 'ubuntu-22.04', 'macos-13', 'macos-14', 'windows-2022', 'ubuntu-22.04-arm' ] python_version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ] runs-on: ${{ matrix.os }} + container: ${{ (matrix.os == 'ubuntu-22.04' && 'ubuntu:20.04') || null }} steps: - uses: actions/checkout@v4 with: From 15ec0bf6fe35d0f4894301cb864792e73ed842c1 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 12:53:14 -0400 Subject: [PATCH 12/28] fix(CI): setting up container --- .github/workflows/test-and-publish.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 33f96714..e924adc9 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -87,8 +87,12 @@ jobs: ./_spidermonkey_install/* key: spidermonkey-${{ env.MOZCENTRAL_VERSION }}-${{ runner.os }}-${{ runner.arch }} lookup-only: true # skip download - - if: ${{ matrix.os == 'ubuntu-22.04' }} - run: apt-get update -y && apt-get install -y sudo + - name: Setup container + if: ${{ matrix.os == 'ubuntu-22.04' }} + run: | + apt-get update -y + apt-get install -y sudo + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata - name: Setup XCode if: ${{ matrix.os == 'macos-13' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }} # SpiderMonkey requires XCode SDK version at least 13.3 From d3dba5bd9b171c01794edc85404b33dfa80fa851 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 13:44:12 -0400 Subject: [PATCH 13/28] fix(CI): do not use the Python installation cached for Ubuntu 22.04 --- .github/workflows/test-and-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index e924adc9..25a6402b 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -93,6 +93,7 @@ jobs: apt-get update -y apt-get install -y sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata + rm -rf $RUNNER_TOOL_CACHE # do not use the Python installation cached for Ubuntu 22.04 - name: Setup XCode if: ${{ matrix.os == 'macos-13' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }} # SpiderMonkey requires XCode SDK version at least 13.3 From 4b72175a9734b3f09411c3dddf4147d1e62d38a3 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 13:48:46 -0400 Subject: [PATCH 14/28] fix(CI): do not use the Python installation cached for Ubuntu 22.04 See also: https://github.com/actions/setup-python/issues/1087 --- .github/workflows/test-and-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 25a6402b..cc997e6d 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -93,7 +93,7 @@ jobs: apt-get update -y apt-get install -y sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata - rm -rf $RUNNER_TOOL_CACHE # do not use the Python installation cached for Ubuntu 22.04 + echo "RUNNER_TOOL_CACHE=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 - name: Setup XCode if: ${{ matrix.os == 'macos-13' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }} # SpiderMonkey requires XCode SDK version at least 13.3 From 6b63f48a67391e1f6f0270d793a304ae32eb52e3 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 13:52:06 -0400 Subject: [PATCH 15/28] fix(CI): setup Python --- .github/workflows/test-and-publish.yaml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index cc997e6d..978ee4b3 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -74,9 +74,6 @@ jobs: container: ${{ (matrix.os == 'ubuntu-22.04' && 'ubuntu:20.04') || null }} # Use the Ubuntu 20.04 container inside Ubuntu 22.04 runner to build steps: - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python_version }} - name: Read the mozilla-central commit hash to be used run: echo "MOZCENTRAL_VERSION=$(cat mozcentral.version)" >> $GITHUB_ENV - name: Cache spidermonkey build @@ -88,12 +85,16 @@ jobs: key: spidermonkey-${{ env.MOZCENTRAL_VERSION }}-${{ runner.os }}-${{ runner.arch }} lookup-only: true # skip download - name: Setup container - if: ${{ matrix.os == 'ubuntu-22.04' }} + if: ${{ matrix.os == 'ubuntu-22.04' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }} run: | apt-get update -y apt-get install -y sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata echo "RUNNER_TOOL_CACHE=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 + - uses: actions/setup-python@v5 + if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }} + with: + python-version: ${{ matrix.python_version }} - name: Setup XCode if: ${{ matrix.os == 'macos-13' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }} # SpiderMonkey requires XCode SDK version at least 13.3 From b86d6dd326ad5c3135bbf2d1f864977f8bfbc3c9 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 13:56:16 -0400 Subject: [PATCH 16/28] fix(CI): `actions/setup-python` do not use cache --- .github/workflows/test-and-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 978ee4b3..9f810a43 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -90,7 +90,7 @@ jobs: apt-get update -y apt-get install -y sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata - echo "RUNNER_TOOL_CACHE=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 + echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 - uses: actions/setup-python@v5 if: ${{ steps.cache-spidermonkey.outputs.cache-hit != 'true' }} with: From bb8845e1550757c5492cf68e6a0942ff96ea6fb5 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 14:01:49 -0400 Subject: [PATCH 17/28] fix(CI): pip can't connect to HTTPS URL because the SSL module is not available --- .github/workflows/test-and-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 9f810a43..f70e6f2a 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -88,7 +88,7 @@ jobs: if: ${{ matrix.os == 'ubuntu-22.04' && steps.cache-spidermonkey.outputs.cache-hit != 'true' }} run: | apt-get update -y - apt-get install -y sudo + apt-get install -y sudo libnss3-dev libssl-dev DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 - uses: actions/setup-python@v5 From 33aacd9859c3f3b72c3b0fc7b0316ff1eeae6a72 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 14:22:59 -0400 Subject: [PATCH 18/28] fix(CI): setup container --- .github/workflows/test-and-publish.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index f70e6f2a..2da6f7b8 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -148,6 +148,14 @@ jobs: runs-on: ${{ matrix.os }} container: ${{ (matrix.os == 'ubuntu-22.04' && 'ubuntu:20.04') || null }} steps: + - name: Setup container + if: ${{ matrix.os == 'ubuntu-22.04' }} + run: | + apt-get update -y + apt-get install -y sudo libnss3-dev libssl-dev + apt-get install -y git # required for `actions/checkout` + DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # tzdata may ask for user interaction if not explicitly installed here + echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 - uses: actions/checkout@v4 with: submodules: recursive From a4179e11e9494fa6f76078321e4d830102bc06bf Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 14:29:22 -0400 Subject: [PATCH 19/28] fix(CI): git failed because of dubious ownership See: https://stackoverflow.com/questions/72978485/git-submodule-update-failed-with-fatal-detected-dubious-ownership-in-reposit --- .github/workflows/test-and-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 2da6f7b8..1f72fc45 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -156,6 +156,7 @@ jobs: apt-get install -y git # required for `actions/checkout` DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # tzdata may ask for user interaction if not explicitly installed here echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 + git config --global --add safe.directory '*' # silence "git failed because of dubious ownership" - uses: actions/checkout@v4 with: submodules: recursive From 9cafc6d27c76ebe4fd6de643dc9219d89809c254 Mon Sep 17 00:00:00 2001 From: Tom Wenzheng Tang Date: Wed, 4 Jun 2025 14:36:59 -0400 Subject: [PATCH 20/28] fix(CI): nodejs and npm are required for pminit to build --- .github/workflows/test-and-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 1f72fc45..46413e52 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -154,6 +154,7 @@ jobs: apt-get update -y apt-get install -y sudo libnss3-dev libssl-dev apt-get install -y git # required for `actions/checkout` + apt-get install -y nodejs npm # required for pminit to build DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # tzdata may ask for user interaction if not explicitly installed here echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 git config --global --add safe.directory '*' # silence "git failed because of dubious ownership" From e77335165ca69dcbf82c389786e82a18064c5f13 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 18:44:01 +0000 Subject: [PATCH 21/28] fix(CI): CMake 3.25 or higher is required --- .github/workflows/test-and-publish.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 46413e52..f7e1fb28 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -158,6 +158,12 @@ jobs: DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # tzdata may ask for user interaction if not explicitly installed here echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 git config --global --add safe.directory '*' # silence "git failed because of dubious ownership" + + # CMake 3.25 or higher is required + apt-get install -y ca-certificates gpg wget + wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null + echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ focal main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null + apt-get update -y && apt-get install -y cmake - uses: actions/checkout@v4 with: submodules: recursive From afdced24dd5d1679fddf014bc9c970a87eacfe35 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 18:49:38 +0000 Subject: [PATCH 22/28] feat(CI): remove core dumps as CI artifacts --- .github/workflows/test-and-publish.yaml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index f7e1fb28..73593436 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -247,18 +247,6 @@ jobs: with: name: wheel-${{ github.run_id }}-${{ github.sha }}-${{ runner.os }}_${{ runner.arch }}_Python${{ matrix.python_version }} path: ./dist/ - - name: Set cores to get stored in /cores - if: ${{ matrix.os != 'windows-2022' }} - # TODO (Caleb Aikens) figure out how to get Windows core dumps - run: | - sudo mkdir -p /cores - sudo chmod 777 /cores - # Core filenames will be of the form osname.pythonversion.executable.pid.timestamp: - if [[ "$OSTYPE" == "linux-gnu"* ]]; then - sudo bash -c 'echo "/cores/${OSTYPE}.$(poetry run python --version).%e.%p.%t" > /proc/sys/kernel/core_pattern' - else - sudo sysctl kern.corefile="/cores/${OSTYPE}.$(poetry run python --version).%e.%p.%y" - fi - name: Run Python tests (pytest) run: | if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then @@ -281,13 +269,6 @@ jobs: uses: fawazahmed0/action-debug@main with: credentials: "admin:admin" - - name: Upload core dumps as CI artifacts - uses: actions/upload-artifact@v4 - if: ${{ matrix.os != 'windows-2022' && failure() }} - # TODO (Caleb Aikens) figure out how to get Windows core dumps - with: - name: cores-${{ matrix.os }}-${{ matrix.python_version }} - path: /cores sdist: runs-on: ubuntu-22.04 steps: From b4a40c2f588d48c84cd5ba07f3038ec7bc75eaad Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 18:56:09 +0000 Subject: [PATCH 23/28] fixup(CI): remove core dumps as CI artifacts core dumps cannot be read in a container --- .github/workflows/test-and-publish.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 73593436..120500f9 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -249,20 +249,12 @@ jobs: path: ./dist/ - name: Run Python tests (pytest) run: | - if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then - # TODO (Caleb Aikens) figure out how to get Windows core dumps - ulimit -c unlimited - fi WORKFLOW_BUILD_TYPE=${{ inputs.build_type }} BUILD_TYPE=${WORKFLOW_BUILD_TYPE:-"Debug"} poetry run python -m pip install --force-reinstall --verbose ./dist/* poetry run python -m pytest tests/python - name: Run JS tests (peter-jr) if: ${{ (success() || failure()) }} run: | - if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then - # TODO (Caleb Aikens) figure out how to get Windows core dumps - ulimit -c unlimited - fi poetry run bash ./peter-jr ./tests/js/ - name: SSH debug session if: ${{ (success() || failure()) && github.event_name == 'workflow_dispatch' && inputs.debug_enabled_os == matrix.os && inputs.debug_enabled_python == matrix.python_version}} From 6a5401a14b1c67be9af73549c318ef980c4baf2a Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 18:58:18 +0000 Subject: [PATCH 24/28] fix(CI): `strace` is required to run JS tests --- .github/workflows/test-and-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 120500f9..86fc2f05 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -155,6 +155,7 @@ jobs: apt-get install -y sudo libnss3-dev libssl-dev apt-get install -y git # required for `actions/checkout` apt-get install -y nodejs npm # required for pminit to build + apt-get install -y strace # required to run JS tests DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # tzdata may ask for user interaction if not explicitly installed here echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 git config --global --add safe.directory '*' # silence "git failed because of dubious ownership" From 2727bc0a137b155f9afc98f63b24cf24f1d49b23 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 19:01:53 +0000 Subject: [PATCH 25/28] feat(CI): nodejs shouldn't be required to build PythonMonkey --- .github/workflows/test-and-publish.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index 86fc2f05..fb03fd06 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -154,7 +154,6 @@ jobs: apt-get update -y apt-get install -y sudo libnss3-dev libssl-dev apt-get install -y git # required for `actions/checkout` - apt-get install -y nodejs npm # required for pminit to build apt-get install -y strace # required to run JS tests DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # tzdata may ask for user interaction if not explicitly installed here echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 From 16561c6a7e38dcae0320ceee9420bf8107db5f1d Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 19:25:09 +0000 Subject: [PATCH 26/28] Revert "feat(CI): nodejs shouldn't be required to build PythonMonkey" This reverts commit 2727bc0a137b155f9afc98f63b24cf24f1d49b23. --- .github/workflows/test-and-publish.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index fb03fd06..bcb7a070 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -154,6 +154,7 @@ jobs: apt-get update -y apt-get install -y sudo libnss3-dev libssl-dev apt-get install -y git # required for `actions/checkout` + apt-get install -y nodejs npm apt-get install -y strace # required to run JS tests DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # tzdata may ask for user interaction if not explicitly installed here echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 From ba5c704e1b22549859ec6c6347eaf4f2c32425d6 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 19:25:52 +0000 Subject: [PATCH 27/28] fix(CI): `build-essential` should be installed instead --- .github/workflows/test-and-publish.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-publish.yaml b/.github/workflows/test-and-publish.yaml index bcb7a070..337e85f6 100644 --- a/.github/workflows/test-and-publish.yaml +++ b/.github/workflows/test-and-publish.yaml @@ -154,7 +154,7 @@ jobs: apt-get update -y apt-get install -y sudo libnss3-dev libssl-dev apt-get install -y git # required for `actions/checkout` - apt-get install -y nodejs npm + apt-get install -y build-essential apt-get install -y strace # required to run JS tests DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata # tzdata may ask for user interaction if not explicitly installed here echo "AGENT_TOOLSDIRECTORY=/" >> $GITHUB_ENV # do not use the Python installation cached for Ubuntu 22.04 From 3879ce69673741ef52ca7c8a25d118e2e3075188 Mon Sep 17 00:00:00 2001 From: Tom Tang Date: Wed, 4 Jun 2025 19:34:13 +0000 Subject: [PATCH 28/28] we shouldn't be testing npm inside of pytests --- tests/python/test_dicts.py | 8 -------- tests/python/test_functions_this.py | 12 ++---------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/tests/python/test_dicts.py b/tests/python/test_dicts.py index 99959926..b3f481fa 100644 --- a/tests/python/test_dicts.py +++ b/tests/python/test_dicts.py @@ -367,14 +367,6 @@ def test_toLocaleString(): pm.eval("(result, obj) => {result[0] = obj.toLocaleString()}")(result, items) assert result[0] == '[object Object]' -# repr - - -def test_repr_max_recursion_depth(): - subprocess.check_call('npm install crypto-js', shell=True) - CryptoJS = pm.require('crypto-js') - assert str(CryptoJS).__contains__("{'lib': {'Base': {'extend':") - # __class__ def test___class__attribute(): diff --git a/tests/python/test_functions_this.py b/tests/python/test_functions_this.py index d9cbf528..52838781 100644 --- a/tests/python/test_functions_this.py +++ b/tests/python/test_functions_this.py @@ -126,14 +126,6 @@ class Class: # require -def test_require_correct_this(): - subprocess.check_call('npm install crypto-js', shell=True) - CryptoJS = pm.require('crypto-js') - cipher = CryptoJS.SHA256("Hello, World!").toString() - assert cipher == "dffd6021bb2bd5b0af676290809ec3a53191dd81c7f70a4b28688a362182986f" - subprocess.check_call('npm uninstall crypto-js', shell=True) - - def test_require_correct_this_old_style_class(): example = pm.eval(""" () => { @@ -207,7 +199,7 @@ def pyFunc(): def test_method_no_self(): class What: def some_method(): - return 3 + return 3 obj = What() @@ -215,4 +207,4 @@ def some_method(): pm.eval('x => x.some_method()')(obj) assert (False) except pm.SpiderMonkeyError as e: - assert 'takes 0 positional arguments but 1 was given' in str(e) \ No newline at end of file + assert 'takes 0 positional arguments but 1 was given' in str(e)