Commit Graph
35 Commits
Author SHA1 Message Date
Mats ea29a6e9d6 Separate list and load actions for source API (#7090)
This is the first PR in API consistency with more to come:

1. The source API urls have been properly defined with
`/source/:source/list` and `/source/:source/load/:language/:filename`
- These used to be two API endpoints mushed together into one `handle()`
function. They are now separate
- While it may appear from the tests that this is an API breakage,
there's currently no way to have the source API spit out responses for
stuff like `/source/moose/load/Grunkle`.
2. The frontend code calling the list api now has shared types
3. Code has been migrated to `/lib/handlers/api/source.ts`
- I've moved code here, because I would like to separate the stuff
that's under the API and the stuff that isn't (e.g., healthcheck)
- The source endpoint is currently not under /api, but I believe it
makes sense to move it.
4. GitHub is terrible at showing the diff, but the `browser.ts` file has
been removed, since it's never actually used. Our frontend only calls
`/source/builtin/...` and it never had any entries. Besides, the type
used on the frontend for the locally stored stuff is different...
2024-11-27 13:54:47 +09:00
Ofek f715dc2932 More tsification (#6877)
About half way through. Only 708 tsification errors to go..
2024-09-28 10:32:36 +03:00
Patrick Quist b8325cf0c6 eslint root setting and fixes (#6307) 2024-04-16 21:26:53 +02:00
Kait Lam 44aa5769c8 Revert "builtin.ts: treat EXAMPLES_PATH as relative to app root." (#6246)
Reverts compiler-explorer/compiler-explorer#6237.

This PR broke the recommended `make run` workflow. When using `make
run`, the dist folder does not contain the needed resources.
2024-03-14 08:05:36 -05:00
Kait Lam 51da64cefb builtin.ts: treat EXAMPLES_PATH as relative to app root. (#6237)
I feel this is the least surprising behaviour most of the time. This
will help when packaging and distributing the application.

It may also make sense to base this at rootDir, but examples/ sits
outside etc/ at the moment and I didn't want to disturb that too much.

Thanks!
2024-03-10 17:44:35 -05:00
Mats Jun LarsenandMatt Godbolt 633eb82d18 Transition to ECMAScript Modules (#4780)
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:

1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)

A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2023-02-27 18:06:38 -06:00
Mats Jun Larsen f2fbf69069 Tsify and refactor lib/handlers/source.js (#4662) 2023-01-30 17:05:36 +01:00
Matt Godbolt f2c1e0bd31 The Grand Reformat (#3643)
* The Grand Reformat

- everything made prettier...literally
- some tweaks to include a few more files, including documentation
- minor changes to format style
- some tiny `// prettier-ignore` changes to keep a few things the way we like them
- a couple of super minor tweaks to embedded document types to ensure they format correctly
2022-05-09 23:13:50 -05:00
Mats Larsen ef8f36df4c Convert lib/sources to TypeScript (#3526) 2022-04-18 16:48:00 +02:00
Austin Morton de85aecc7d Normalize and enforce license disclaimer headers (#2234) 2020-09-27 00:20:19 -04:00
Matt Godbolt f68198af9e Reassign copyright to Compiler Explorer Authors (#2233) 2020-09-26 17:50:40 -05:00
Austin Morton 044dcfbf88 Use ES6 Modules (#2132) 2020-09-26 16:59:26 -04:00
Austin Morton bac07fea6d Eliminate all dynamic require statements (#2230) 2020-09-25 11:21:30 -04:00
Rubén Rincón BlancoandAustin Morton ccff4b9ee5 Add new eslint rules (#2121)
The largest changes here are:
- enforcing single quotes for strings
- enforcing trailing commas where possible

In addition to those we have enabled several eslint plugins:
- plugin:requirejs/recommended, to enforce some conventions in require statements
- plugin:node/recommended, to enforce correct usage of various node.js APIs
- plugin:unicorn/recommended, which contains a pretty mixed bag of useful rules

This PR attempts to not change code behavior when possible.  In cases where fixing
existing code would change semantics, a linting exclusion has been placed in the 
code base to silence the error.  You can find these by searching for `eslint-disable-next-line`.

Co-authored-by: Austin Morton <austinpmorton@gmail.com>
2020-08-04 16:39:02 -04:00
RabsRincon 7c18ffe8cf Drop underscore-node in favour of underscore.js
After some suprises about how outdated the node version was compared to
	the main project, it became clear we needed to do something.
	@jaredwy suggested using the main project as there's now nothing
	stopping us from using it after the switch to webpack.

cc @mattgodbolDrop underscore-node in favour of underscore.js
2018-06-15 15:04:55 +02:00
RabsRincon 6ef87b5ef9 Fix copyright dates and normalize text 2018-02-27 14:58:21 +01:00
Matt Godbolt 41e067d8ed Typo fix, no functional change 2018-01-23 08:58:31 -06:00
RabsRincon 80a7313e32 Improve CFG implementation
No longer creates the cfg nodes if not needed. CFG Structure creation
	is now simpler. Some bugfixes. Tests now actually run
2018-01-15 19:16:15 +01:00
RabsRincon fc75208dac New year, new date 2018-01-01 16:44:04 +01:00
Matt Godbolt 5a2066b6b5 Merge branch 'master' into unification 2017-12-21 11:12:54 -06:00
Matt Godbolt 96371a9ad6 Get rid of old style module setup 2017-12-21 11:10:34 -06:00
Matt Godbolt 69ee80412d Merge branch 'master' into unification 2017-12-21 11:05:12 -06:00
Matt Godbolt 22c87055fe Extract source handler 2017-12-21 10:58:24 -06:00
RabsRincon 08d58bc5b4 Appease the linter
Oops, forgot to run the linter before pushing...
2017-12-09 11:26:21 +01:00
RabsRincon 43279a61ca Fix various points raised after code reviews
Some fixes, a great slam and then some
2017-12-09 11:19:45 +01:00
Matt Godbolt b6e9a4658b Another year, another copyright update 2017-01-02 10:14:46 -06:00
Matt Godbolt 8610ec9316 Update copyright 2016-04-05 21:39:41 -05:00
Matt Godbolt ce7d6661be More config tweaks; fix up TODO 2015-11-27 15:45:38 -06:00
Matt Godbolt 79a0f6e12d Misc WIP on changing configuration to be lang-specific and to fix up some more binary things found along the way 2015-11-26 13:12:56 -06:00
Matt Godbolt d7e318b647 Misc tidyups 2015-11-23 23:22:19 -06:00
Ola Jeppsson 10aec86d0a Fix sorting of examples
Compare function should return negative, 0, or a positive integer.
Not true or false.

Signed-off-by: Ola Jeppsson <ola@adapteva.com>
2015-08-08 14:36:44 +02:00
Matt Godbolt c9bc4eef58 Copyright update, formatting changes 2015-01-12 07:21:22 -06:00
Matt Godbolt c60cad2e7e Add IDEA files.
Update copyrights, fix jslint issues, tidy code.
2014-11-26 08:24:40 -06:00
Matt Godbolt 43a2173b38 Early rust support 2014-04-30 21:55:02 -05:00
Matt Godbolt 15ea5e164b Initial import of GCC-Explorer 2012-05-22 21:07:40 -05:00