feat: use ast-based helpers (#53125)

This commit is contained in:
Oliver Eyton-Williams
2024-02-28 09:31:58 +01:00
committed by GitHub
parent d08e497686
commit 630fdac393
4 changed files with 128 additions and 67 deletions
@@ -25,6 +25,14 @@ The `hello` variable should equal "world".
({ test: () => assert.equal(__userGlobals.get("hello"), "world") })
```
The `one` variable should be an integer.
```js
({ test: () => {
assert(runPython(`_Node(_code).find_variable("one").is_integer()`))
}})
```
# --seed--
## --seed-contents--
+96 -66
View File
@@ -1277,8 +1277,8 @@ importers:
specifier: 7.23.3
version: 7.23.3(@babel/core@7.23.7)
'@freecodecamp/curriculum-helpers':
specifier: 1.3.0
version: 1.3.0
specifier: 2.3.0
version: 2.3.0
'@types/chai':
specifier: 4.3.12
version: 4.3.12
@@ -2392,7 +2392,7 @@ packages:
'@babel/traverse': 7.23.7
'@babel/types': 7.23.9
convert-source-map: 2.0.0
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@@ -2629,7 +2629,7 @@ packages:
'@babel/core': 7.23.7
'@babel/helper-compilation-targets': 7.23.6
'@babel/helper-plugin-utils': 7.22.5
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
lodash.debounce: 4.0.8
resolve: 1.22.8
transitivePeerDependencies:
@@ -6105,7 +6105,7 @@ packages:
'@babel/helper-split-export-declaration': 7.22.6
'@babel/parser': 7.23.6
'@babel/types': 7.23.9
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@@ -6505,7 +6505,7 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies:
ajv: 6.12.6
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
espree: 9.6.1
globals: 13.22.0
ignore: 5.2.4
@@ -6674,8 +6674,8 @@ packages:
react: 16.14.0
dev: false
/@freecodecamp/curriculum-helpers@1.3.0:
resolution: {integrity: sha512-NAMaeE1rOfr58n/MQWzgsoNi2z72/pnFwvJl+wBFJ6MUiCh+zcueksLllVgSpwSrnsEPYXen8K+T8oqfHWe0RQ==}
/@freecodecamp/curriculum-helpers@2.3.0:
resolution: {integrity: sha512-eOYrVZX8fxsjYaCiaM+Hp/vnUADdeWqBNLZYy9BETF7Y/lYezezoUitHCL9x4RzDH+npWQbVUVCC0Eivz/HoWQ==}
engines: {npm: '>= 4.0.0'}
dependencies:
browserify: 17.0.0
@@ -6986,7 +6986,7 @@ packages:
engines: {node: '>=10.10.0'}
dependencies:
'@humanwhocodes/object-schema': 2.0.2
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
minimatch: 3.1.2
transitivePeerDependencies:
- supports-color
@@ -10930,7 +10930,7 @@ packages:
'@typescript-eslint/type-utils': 6.21.0(eslint@8.57.0)(typescript@5.2.2)
'@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.2.2)
'@typescript-eslint/visitor-keys': 6.21.0
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
eslint: 8.57.0
graphemer: 1.4.0
ignore: 5.2.4
@@ -11008,7 +11008,7 @@ packages:
'@typescript-eslint/types': 6.21.0
'@typescript-eslint/typescript-estree': 6.21.0(typescript@5.2.2)
'@typescript-eslint/visitor-keys': 6.21.0
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
eslint: 8.57.0
typescript: 5.2.2
transitivePeerDependencies:
@@ -11048,7 +11048,7 @@ packages:
dependencies:
'@typescript-eslint/typescript-estree': 6.21.0(typescript@5.2.2)
'@typescript-eslint/utils': 6.21.0(eslint@8.57.0)(typescript@5.2.2)
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
eslint: 8.57.0
ts-api-utils: 1.0.3(typescript@5.2.2)
typescript: 5.2.2
@@ -11125,7 +11125,7 @@ packages:
dependencies:
'@typescript-eslint/types': 5.62.0
'@typescript-eslint/visitor-keys': 5.62.0
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
semver: 7.6.0
@@ -11146,7 +11146,7 @@ packages:
dependencies:
'@typescript-eslint/types': 6.21.0
'@typescript-eslint/visitor-keys': 6.21.0
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.3
@@ -11978,7 +11978,7 @@ packages:
/array-buffer-byte-length@1.0.0:
resolution: {integrity: sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
is-array-buffer: 3.0.2
/array-find-index@1.0.2:
@@ -12038,7 +12038,7 @@ packages:
/array.prototype.find@2.2.2:
resolution: {integrity: sha512-DRumkfW97iZGOfn+lIXbkVrXL04sfYKX+EfOodo8XboR5sxPDVvOjZTF/rysusa9lmhmSOeD6Vp6RKQP+eP4Tg==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
define-properties: 1.2.1
es-abstract: 1.22.2
es-shim-unscopables: 1.0.0
@@ -12108,10 +12108,10 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
array-buffer-byte-length: 1.0.0
call-bind: 1.0.2
call-bind: 1.0.7
define-properties: 1.2.1
es-abstract: 1.22.2
get-intrinsic: 1.2.1
get-intrinsic: 1.2.4
is-array-buffer: 3.0.2
is-shared-array-buffer: 1.0.2
@@ -12143,7 +12143,7 @@ packages:
/assert@1.5.1:
resolution: {integrity: sha512-zzw1uCAgLbsKwBfFc8CX78DDg+xZeBksSO3vwVIDDN5i94eOrPsSSyiVhmsSABFDM/OcpE2aagCat9dnWQLG1A==}
dependencies:
object.assign: 4.1.4
object.assign: 4.1.5
util: 0.10.4
dev: true
@@ -15732,6 +15732,7 @@ packages:
dependencies:
ms: 2.1.3
supports-color: 8.1.1
dev: true
/debug@4.3.1:
resolution: {integrity: sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==}
@@ -15767,6 +15768,7 @@ packages:
dependencies:
ms: 2.1.2
supports-color: 8.1.1
dev: true
/decamelize@1.2.0:
resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
@@ -15824,9 +15826,9 @@ packages:
resolution: {integrity: sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==}
dependencies:
array-buffer-byte-length: 1.0.0
call-bind: 1.0.2
call-bind: 1.0.7
es-get-iterator: 1.1.3
get-intrinsic: 1.2.1
get-intrinsic: 1.2.4
is-arguments: 1.1.1
is-array-buffer: 3.0.2
is-date-object: 1.0.5
@@ -15835,7 +15837,7 @@ packages:
isarray: 2.0.5
object-is: 1.1.5
object-keys: 1.1.1
object.assign: 4.1.4
object.assign: 4.1.5
regexp.prototype.flags: 1.5.1
side-channel: 1.0.4
which-boxed-primitive: 1.0.2
@@ -15899,7 +15901,7 @@ packages:
resolution: {integrity: sha512-UzGwzcjyv3OtAvolTj1GoyNYzfFR+iqbGjcnBEENZVCpM4/Ng1yhGNvS3lR/xDS74Tb2wGG9WzNSNIOS9UVb2g==}
engines: {node: '>= 0.4'}
dependencies:
get-intrinsic: 1.2.1
get-intrinsic: 1.2.4
gopd: 1.0.1
has-property-descriptors: 1.0.0
@@ -16692,8 +16694,8 @@ packages:
/es-get-iterator@1.1.3:
resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.1
call-bind: 1.0.7
get-intrinsic: 1.2.4
has-symbols: 1.0.3
is-arguments: 1.1.1
is-map: 2.0.2
@@ -16728,7 +16730,7 @@ packages:
resolution: {integrity: sha512-g3OMbtlwY3QewlqAiMLI47KywjWZoEytKr8pf6iTC8uJq5bIAH52Z9pnQ8pVL6whrCto53JZDuUIsifGeLorTg==}
engines: {node: '>= 0.4'}
dependencies:
get-intrinsic: 1.2.1
get-intrinsic: 1.2.4
has: 1.0.3
has-tostringtag: 1.0.0
@@ -16917,7 +16919,7 @@ packages:
/eslint-import-resolver-node@0.3.9:
resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==}
dependencies:
debug: 3.2.7(supports-color@8.1.1)
debug: 3.2.7
is-core-module: 2.13.1
resolve: 1.22.8
transitivePeerDependencies:
@@ -16930,10 +16932,10 @@ packages:
eslint: '*'
eslint-plugin-import: '*'
dependencies:
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
enhanced-resolve: 5.15.0
eslint: 8.57.0
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.5.5)(eslint@8.57.0)
eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.57.0)
eslint-plugin-import: 2.29.1(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.57.0)
get-tsconfig: 4.7.2
globby: 13.2.2
@@ -16997,13 +16999,41 @@ packages:
optional: true
dependencies:
'@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2)
debug: 3.2.7(supports-color@8.1.1)
debug: 3.2.7
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@6.21.0)(eslint-plugin-import@2.29.1)(eslint@8.57.0)
transitivePeerDependencies:
- supports-color
/eslint-module-utils@2.8.0(@typescript-eslint/parser@6.21.0)(eslint-import-resolver-typescript@3.5.5)(eslint@8.57.0):
resolution: {integrity: sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==}
engines: {node: '>=4'}
peerDependencies:
'@typescript-eslint/parser': '*'
eslint: '*'
eslint-import-resolver-node: '*'
eslint-import-resolver-typescript: '*'
eslint-import-resolver-webpack: '*'
peerDependenciesMeta:
'@typescript-eslint/parser':
optional: true
eslint:
optional: true
eslint-import-resolver-node:
optional: true
eslint-import-resolver-typescript:
optional: true
eslint-import-resolver-webpack:
optional: true
dependencies:
'@typescript-eslint/parser': 6.21.0(eslint@8.57.0)(typescript@5.2.2)
debug: 3.2.7
eslint: 8.57.0
eslint-import-resolver-typescript: 3.5.5(@typescript-eslint/parser@6.21.0)(eslint-plugin-import@2.29.1)(eslint@8.57.0)
transitivePeerDependencies:
- supports-color
/eslint-plugin-filenames-simple@0.9.0(eslint@8.57.0):
resolution: {integrity: sha512-eIs+fIO/YXjjlNRdMK3H2HiF0BJ6zj3Of1+REBMnHMbqqgxX1VReIV/gf+ZfP3/bbCAHk5PE3SXi7Fjt3uzUGw==}
engines: {node: '>=14.17.0'}
@@ -17091,7 +17121,7 @@ packages:
array.prototype.findlastindex: 1.2.3
array.prototype.flat: 1.3.2
array.prototype.flatmap: 1.3.2
debug: 3.2.7(supports-color@8.1.1)
debug: 3.2.7
doctrine: 2.1.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
@@ -17131,7 +17161,7 @@ packages:
'@es-joy/jsdoccomment': 0.39.4
are-docs-informative: 0.0.2
comment-parser: 1.3.1
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
escape-string-regexp: 4.0.0
eslint: 8.57.0
esquery: 1.5.0
@@ -17415,7 +17445,7 @@ packages:
ajv: 6.12.6
chalk: 4.1.2
cross-spawn: 7.0.3
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
doctrine: 3.0.0
escape-string-regexp: 4.0.0
eslint-scope: 7.2.2
@@ -18294,7 +18324,7 @@ packages:
debug:
optional: true
dependencies:
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
/for-each@0.3.3:
resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==}
@@ -19348,8 +19378,8 @@ packages:
resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==}
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.1
call-bind: 1.0.7
get-intrinsic: 1.2.4
/get-tsconfig@4.7.2:
resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==}
@@ -19783,7 +19813,7 @@ packages:
/has-property-descriptors@1.0.0:
resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==}
dependencies:
get-intrinsic: 1.2.1
get-intrinsic: 1.2.4
/has-property-descriptors@1.0.2:
resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==}
@@ -20622,7 +20652,7 @@ packages:
resolution: {integrity: sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==}
engines: {node: '>= 0.4'}
dependencies:
get-intrinsic: 1.2.1
get-intrinsic: 1.2.4
has: 1.0.3
side-channel: 1.0.4
@@ -20705,8 +20735,8 @@ packages:
/is-array-buffer@3.0.2:
resolution: {integrity: sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.1
call-bind: 1.0.7
get-intrinsic: 1.2.4
is-typed-array: 1.1.12
/is-arrayish@0.2.1:
@@ -20870,7 +20900,7 @@ packages:
/is-finalizationregistry@1.0.2:
resolution: {integrity: sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
/is-finite@1.1.0:
resolution: {integrity: sha512-cdyMtqX/BOqqNBBiKlIVkytNHm49MtMlYyn1zxzvJKWmFMlGzm+ry5BBfYyeY9YmNKbRSo/o7OX9w9ale0wg3w==}
@@ -21079,7 +21109,7 @@ packages:
/is-shared-array-buffer@1.0.2:
resolution: {integrity: sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
/is-ssh@1.4.0:
resolution: {integrity: sha512-x7+VxdxOdlV3CYpjvRLBv5Lo9OJerlYanjwFrPR9fuGPjCiNiCzFgAWpiLAohSbsnH4ZAys3SBh+hq5rJosxUQ==}
@@ -21159,13 +21189,13 @@ packages:
/is-weakref@1.0.2:
resolution: {integrity: sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
/is-weakset@2.0.2:
resolution: {integrity: sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.1
call-bind: 1.0.7
get-intrinsic: 1.2.4
/is-whitespace-character@1.0.4:
resolution: {integrity: sha512-SDweEzfIZM0SJV0EUga669UTKlmL0Pq8Lno0QDQsPnvECB3IM2aP0gdx5TrU0A01MAPfViaZiI2V1QMZLaKK5w==}
@@ -21293,7 +21323,7 @@ packages:
resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==}
engines: {node: '>=10'}
dependencies:
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
istanbul-lib-coverage: 3.2.0
source-map: 0.6.1
transitivePeerDependencies:
@@ -21326,7 +21356,7 @@ packages:
resolution: {integrity: sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==}
dependencies:
define-properties: 1.2.1
get-intrinsic: 1.2.1
get-intrinsic: 1.2.4
has-symbols: 1.0.3
reflect.getprototypeof: 1.0.4
set-function-name: 2.0.1
@@ -22434,7 +22464,7 @@ packages:
cli-truncate: 3.1.0
colorette: 2.0.20
commander: 9.5.0
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
execa: 6.1.0
lilconfig: 2.0.6
listr2: 5.0.8
@@ -27660,10 +27690,10 @@ packages:
resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==}
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
define-properties: 1.2.1
es-abstract: 1.22.2
get-intrinsic: 1.2.1
get-intrinsic: 1.2.4
globalthis: 1.0.3
which-builtin-type: 1.1.3
@@ -27717,7 +27747,7 @@ packages:
resolution: {integrity: sha512-sy6TXMN+hnP/wMy+ISxg3krXx7BAtWVO4UouuCN/ziM9UEne0euamVNafDfvC83bRNr95y0V5iijeDQFUNpvrg==}
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
define-properties: 1.2.1
set-function-name: 2.0.1
@@ -28333,8 +28363,8 @@ packages:
resolution: {integrity: sha512-6XbUAseYE2KtOuGueyeobCySj9L4+66Tn6KQMOPQJrAJEowYKW/YR/MGJZl7FdydUdaFu4LYyDZjxf4/Nmo23Q==}
engines: {node: '>=0.4'}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.1
call-bind: 1.0.7
get-intrinsic: 1.2.4
has-symbols: 1.0.3
isarray: 2.0.5
@@ -28354,8 +28384,8 @@ packages:
/safe-regex-test@1.0.0:
resolution: {integrity: sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.1
call-bind: 1.0.7
get-intrinsic: 1.2.4
is-regex: 1.1.4
/safe-regex2@2.0.0:
@@ -28796,8 +28826,8 @@ packages:
/side-channel@1.0.4:
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.1
call-bind: 1.0.7
get-intrinsic: 1.2.4
object-inspect: 1.12.3
/signal-exit@3.0.7:
@@ -29219,7 +29249,7 @@ packages:
arg: 5.0.2
bluebird: 3.7.2
check-more-types: 2.24.0
debug: 4.3.4(supports-color@8.1.1)
debug: 4.3.4
execa: 5.1.1
lazy-ass: 1.6.0
ps-tree: 1.2.0
@@ -29446,14 +29476,14 @@ packages:
/string.prototype.trimend@1.0.7:
resolution: {integrity: sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
define-properties: 1.2.1
es-abstract: 1.22.2
/string.prototype.trimstart@1.0.7:
resolution: {integrity: sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
define-properties: 1.2.1
es-abstract: 1.22.2
@@ -30650,15 +30680,15 @@ packages:
resolution: {integrity: sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==}
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.2
get-intrinsic: 1.2.1
call-bind: 1.0.7
get-intrinsic: 1.2.4
is-typed-array: 1.1.12
/typed-array-byte-length@1.0.0:
resolution: {integrity: sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==}
engines: {node: '>= 0.4'}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
for-each: 0.3.3
has-proto: 1.0.1
is-typed-array: 1.1.12
@@ -30668,7 +30698,7 @@ packages:
engines: {node: '>= 0.4'}
dependencies:
available-typed-arrays: 1.0.5
call-bind: 1.0.2
call-bind: 1.0.7
for-each: 0.3.3
has-proto: 1.0.1
is-typed-array: 1.1.12
@@ -30676,7 +30706,7 @@ packages:
/typed-array-length@1.0.4:
resolution: {integrity: sha512-KjZypGq+I/H7HI5HlOoGHkWUUGq+Q0TPhQurLbyrVrvnKTBgzLhIJ7j6J/XTQOi0d1RjyZ0wdas8bKs2p0x3Ng==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
for-each: 0.3.3
is-typed-array: 1.1.12
@@ -30741,7 +30771,7 @@ packages:
/unbox-primitive@1.0.2:
resolution: {integrity: sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==}
dependencies:
call-bind: 1.0.2
call-bind: 1.0.7
has-bigints: 1.0.2
has-symbols: 1.0.3
which-boxed-primitive: 1.0.2
@@ -28,7 +28,7 @@
"@babel/plugin-transform-runtime": "7.23.7",
"@babel/preset-env": "7.23.7",
"@babel/preset-typescript": "7.23.3",
"@freecodecamp/curriculum-helpers": "1.3.0",
"@freecodecamp/curriculum-helpers": "2.3.0",
"@types/chai": "4.3.12",
"@types/copy-webpack-plugin": "^8.0.1",
"@types/enzyme": "3.10.16",
@@ -46,6 +46,15 @@ async function setupPyodide() {
// pyodide modifies self while loading.
Object.freeze(self);
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
pyodide.FS.writeFile(
'/home/pyodide/ast_helpers.py',
helpers.python.astHelpers,
{
encoding: 'utf8'
}
);
ctx.postMessage({ type: 'contentLoaded' });
return pyodide;
@@ -131,6 +140,20 @@ def __inputGen(xs):
input = __inputGen(${JSON.stringify(input ?? [])})
`);
runPython(`from ast_helpers import Node as _Node`);
// The tests need the user's code as a string, so we write it to the virtual
// filesystem.
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
pyodide.FS.writeFile('/user_code.py', code, { encoding: 'utf8' });
runPython(`
with open("/user_code.py", "r") as f:
from ast import parse as _parse
_code = f.read()
_tree = _parse(_code)
`);
// Evaluates the learner's code so that any variables they define are
// available to the test.
try {