Commit Graph

36 Commits

Author SHA1 Message Date
Shaun Hamilton
c620077a7b fix(client): use iframe document element for transform (#45155) 2022-02-18 10:52:15 +01:00
Oliver Eyton-Williams
b1fb6adc39 fix: insert user html more consistently (#42195)
* fix: use an iframe to preserve head and body

* fix: remove unnecessary parsing of html

The contents gets inserted into the DOM during transformHtml, which
is always part of the build pipeline

* fix: pipe contents through iframe

* refactor: use the same code for both transforms

* fix: try to handle test errors better

Co-authored-by: moT01 <20648924+moT01@users.noreply.github.com>
2022-01-24 18:02:25 +00:00
Oliver Eyton-Williams
a00788417a fix(client): stop injecting extra comments into preview (#44723) 2022-01-13 13:25:55 -08:00
Oliver Eyton-Williams
f613a1e5fd fix: index.css/js to styles/script (#44356)
* fix: replace index with script/styles as needed

* fix: remove redundant fileKey

It's overwritten by createPoly, so the parser does not need to create it

* fix: curriculum test suite

* Update client/src/templates/Challenges/classic/MultifileEditor.js

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
2021-12-03 12:32:29 -08:00
Oliver Eyton-Williams
e118dda13a fix: order imports and remove circular dependencies (#41824)
* fix: remove circular dependency

redux depended on templates/Challenges/redux and vice versa.  This
meant that import order mattered and confusing bugs could arise.

(cherry picked from commit 7d67a4e70922bbb3051f2f9982dcc69e240d43dc)

* feat: require imports to be in alphabetical order

Import order generally does not matter, but there are edge cases
(circular  imports and css imports, for example) where changing order
changes behaviour

(cherry picked from commit b8d1393a91ec6e068caf8e8498a5c95df68c2b2c)

* chore: order imports

* fix: lift up challenge description + title comps

This brings the classic Show closer to the others as they
now all create the description and title components

* fix: remove donation-saga/index circular import

(cherry picked from commit 51a44ca668a700786d2744feffeae4fdba5fd207)

* refactor: extract action-types from settings

(cherry picked from commit 25e26124d691c84a0d0827d41dafb761c686fadd)

* fix: lint errors

* feat: prevent useless renames
2021-08-02 08:39:40 -05:00
Oliver Eyton-Williams
440169a7cb feat: conditionally include files (#42205)
Co-authored-by: Shaun Hamilton <51722130+ShaunSHamilton@users.noreply.github.com>
2021-06-05 11:15:13 -07:00
Oliver Eyton-Williams
128cb813cb fix: remove unused polyvinyl functions (#42295) 2021-05-31 21:16:26 +05:30
Oliver Eyton-Williams
9be2fb9a10 fix: use lodash-es in the client (#41931) 2021-04-28 16:11:20 -05:00
Mrugesh Mohapatra
ad9b1f89d8 fix(api, client): update Gatsby, webpack & related things (#41452)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
2021-03-25 12:13:43 -07:00
Mrugesh Mohapatra
6c91f81b0e chore(deps): upgrade eslint, prettier & related packages 2021-03-11 12:19:42 +05:30
Oliver Eyton-Williams
e363bb9810 fix: ensure babel presets load (#41233)
In rare cases, loadPresetReact could get into a race with itself. In
these cases the first call would set presetReact and the second call
would exit early as a result.  This would mean babelOptionsJSX would be
undefined and the transformation would fail.
2021-02-23 20:22:20 +05:30
Oliver Eyton-Williams
fffc0e51ec chore(client): refactor & organise config (#40875) 2021-02-03 15:22:07 +05:30
Oliver Eyton-Williams
eb75f8c8cc fix(client): ensure presetEnv is loaded (#39431)
Prior to this, if a user first loaded a React challenge and then
navigated to a JS challenge, they would see
TypeError: Cannot read property 'presets' of undefined
in the console and be unable to run tests or evaluate code until they
reloaded the page.
2020-08-19 13:30:46 -07:00
Oliver Eyton-Williams
b4926052f4 chore: refactor and simplify testing (#39050) 2020-06-13 14:57:15 +05:30
Oliver Eyton-Williams
5e56a9a938 Feat(curriculum): scss not sass (#38764) 2020-05-09 20:01:18 +05:30
Oliver Eyton-Williams
5b80595fbf fix: remove useless logging (#38246) 2020-02-21 15:08:53 +05:30
Oliver Eyton-Williams
7cdf01276d fix: ensure Babel options exist when used
Also renamed 'config' to 'options' to be consistent with the calling
function.
2020-02-20 19:52:23 +05:30
Oliver Eyton-Williams
ebc6197c54 fix: assume scripts inside HTML are js, not jsx 2020-02-20 19:52:23 +05:30
Oliver Eyton-Williams
d87c16e65e fix: only load preset when needed 2020-02-20 19:52:23 +05:30
Oliver Eyton-Williams
21833ab508 fix: load all Babel libs dynamically 2020-02-20 19:52:23 +05:30
Oliver Eyton-Williams
c6eb40ceef feat: remove protection from interview prep (#38136)
The interview prep section includes many challenges that require long
running calculations which can be mistaken for infinite loops. This
removes the loop protection from those challenges, while the tests are
being evaluated.

It keeps the protection for the preview, since it is easy to create
broken code while working on a challenge and that should not crash the
site.
2020-02-04 10:33:56 +05:30
Oliver Eyton-Williams
f5feff386a fix: stop user code after 500ms of execution
Code like `var xs = []; while(true){ xs.push(1) }` can quickly run the
browser out of memory causing it to crash.  These changes stop user loops
from running indefinitely so that common mistakes will no longer cause
the browser to crash.

Also, the user is informed if a long running loop is detected (js and
jsx challenges) during preview or testing.  Before this there was no
protection for js challenges and no information was given to the
user if they had created such a loop.

Co-Authored-By: Tom <20648924+moT01@users.noreply.github.com>
Co-Authored-By: mrugesh <1884376+raisedadead@users.noreply.github.com>
Co-Authored-By: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
2020-01-03 11:41:52 +05:30
Oliver Eyton-Williams
e5abfa15ad Revert "fix: stop user code after 100ms of execution" (#37965)
This reverts commit 01b37f664f.
2019-12-21 11:09:32 +05:30
Oliver Eyton-Williams
01b37f664f fix: stop user code after 100ms of execution (#37841)
Co-authored-by: mrugesh <1884376+raisedadead@users.noreply.github.com>
Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2019-12-20 19:28:17 +05:30
Oliver Eyton-Williams
beecb04c1a fix: report errors thrown after the frame is ready
Certain challenges involve code that is not run until the user
interacts with the preview (typically via a click listener). This uses
consoleProxy to report those errors.

Error logging has been simplified, reducing the number of places errors
can be reported from.

Some of the redux-saga code has been renamed in an attempt to improve
clarity.
2019-11-19 22:23:57 +05:30
Oliver Eyton-Williams
687c4fdb98 fix(client): add cache-busting hashes to chunks (#37746)
* fix(client): add cache-busting hashes to chunks

* fix: create cache-busting names for the workers

Prior to this PR the first webpack compilation gave the workers static
names.  This can cause caching problems, so this PR adds hashes to
their names to invalidate the cache.

In order for Gatsby to find them, the names are added to the
config directory.
2019-11-15 01:43:44 +05:30
Valeriy S
845b966bda fix(client): execute web workers concurrently 2019-03-29 15:06:10 +05:30
Bouncey
b13e5fb41a feat: Use prettier-eslint to format code 2019-02-19 14:30:27 +05:30
Valeriy
dcca74ab92 fix: use factory method to create worker executor 2019-01-14 13:44:54 +00:00
Valeriy S
cc0b504224 fix(client): tune a worker executor 2019-01-14 13:44:54 +00:00
Valeriy S
4bf89a873e fix(client): transform html scripts 2019-01-10 11:29:53 +00:00
Valeriy
a4fd935b8b feat: execute js challenges saga 2018-12-06 13:05:09 +00:00
Valeriy S
ea060b13f2 fix: rename SASS worker 2018-11-12 12:44:00 +00:00
Valeriy
ecadba95db fix(client): prevent endless SASS conversion 2018-11-12 12:44:00 +00:00
Valeriy
3123f8c5b9 fix(learn): transformers don't apply 2018-10-06 02:39:36 +01:00
Bouncey
5b254f3ad6 chore(learn): Merge learn in to the client app 2018-09-30 12:42:40 +01:00