Commit graph

3414 commits

Author SHA1 Message Date
Isiah Meadows
41e8b614e1 Maybe *this* time, everything should magically work... 2019-05-29 11:44:57 -04:00
Isiah Meadows
836d35a6e3 This folder shouldn't have been committed 2019-05-29 11:18:38 -04:00
Isiah Meadows
3befb96909 Regenerate docs since I seem to be having Travis permission errors... 2019-05-29 10:30:15 -04:00
Isiah Meadows
f1d001cfcd v2.0.0-rc.5 2019-05-29 10:23:40 -04:00
Isiah Meadows
7fb47852c0 Run npm audit fix and prune 2019-05-29 10:23:18 -04:00
Isiah Meadows
3b301d928e Merge branch 'next' 2019-05-29 10:18:48 -04:00
Isiah Meadows
51e0aee2ab Update SSH key because I'm apparently dumb
- The SSH issue does appear *fixed*.
2019-05-29 10:10:53 -04:00
Isiah Meadows
89e1f5d8d3 Attempt to fix docs generation issues 2019-05-29 09:57:16 -04:00
Stephan Hoyer
852fd1b166 Update docs/request.md
Co-Authored-By: isiahmeadows <contact@isiahmeadows.com>
2019-05-29 09:44:31 -04:00
Isiah
09ccf0e3b3 Bundled output for commit 794e8e963f [skip ci] 2019-05-29 13:43:31 +00:00
Isiah Meadows
794e8e963f
Bring some sanity to request parsing and error handling (#2335)
* Update docs/request.md
* Bring some sanity to request parsing and error handling

- The browser can do JSON parsing itself. Let's defer to that where
  possible. (A few IE hacks are required here, though.)
- Don't propagate any error that occurs before `deserialize`/`extract`.
- Allow sending raw array buffers/blobs/etc. to `deserialize`.
- Align behavior more closely with the XHR spec.
- Send the more useful parsed response to `deserialize`, not the less
  useful string response.
2019-05-29 09:41:22 -04:00
Isiah
09afc54c7b Bundled output for commit 58f1c74394 [skip ci] 2019-05-29 13:30:52 +00:00
Isiah Meadows
58f1c74394
Streamline route/request path handling and split params + body in requests (#2361)
Fixes #2360
Fixes #1138
Fixes #1788 a little less hackishly
Probably fixes a few other issues I'm not aware of.

This more or less goes with @lhorie's comment here, just with a minor name
change from `query` to `params`:

https://github.com/MithrilJS/mithril.js/issues/1138#issuecomment-231363395

Specifically, here's what this patch entails:

- I changed `data` and `useBody` to `params` and `body` in `m.request`.
  Migration is trivial: just use `params` or `body` depending on which you
  intend to send. Most servers do actually care where the data goes, so you can
  generally pretty easily translate this accordingly. If you *really* need the
  old behavior, pass the old value in `params` and if `method === "GET"` or
  `method === "TRACE"`, also in `body`.
- I opened up all methods to have request bodies.
- I fixed `m.parseQueryString` to prefer later values over earlier values and
  to ensure that objects and arrays are persisted across both hash and query
  param parsing. That method also accepts an existing key/value map to append
  to, to simplify deduplication.
- I normalized path interpolation to be identical between routes and requests.
- I no longer include interpolated values in query strings. If you need to
  duplicate values again, rename the interpolation to be a distinct property
  and pass the value you want to duplicate as it.
- I converted `m.route` to use pre-compiled routes instead of its existing
  system of dynamic runtime checking. This shouldn't have a major effect on
  performance short-term, but it'll ease the migration to built-in userland
  components and make it a little easier to reconcile. It'll also come handy
  for large numbers of routes.
- I added support for matching routes like `"/:file.:ext"` or
  `"/:lang-:region"`, giving each defined semantics.
- I added support for matching against routes with static query strings, such
  as `"/edit?type=image": { ... }`.
- I'm throwing a few new informative errors.
- And I've updated the docs accordingly.

I also made a few drive-by edits:

- I fixed a bug in the `Stream.HALT` warning where it warned all but the first
  usage when the intent was to warn only on first use.
- Some of the tests were erroneously using `Stream.HALT` when they should've
  been using `Stream.SKIP`. I've fixed the tests to only test that
  `Stream.HALT === Stream.SKIP` and that it only warns on first use.
- The `m.request` and `m.jsonp` docs signatures were improved to more clearly
  explain how `m.request(url, options?)` and `m.jsonp(url, options?)` translate
  to `m.request(options)` and `m.jsonp(options)` respectively.

-----

There is some justification to these changes:

- In general, it matters surprisingly more than you would expect how things
  translate to HTTP requests. So the comment there suggesting a thing that
  papers over the difference has led to plenty of confusion in both Gitter and
  in GitHub issues.

- A lot of servers expect a GET with a body and no parameters, and leaving
  `m.request` open to working with that makes it much more flexible.

- Sometimes, servers expect a POST with query parameters *instead* of a JSON
  object. I've seen this quite a bit, even with more popular REST APIs like
  Stack Overflow's.

- I've encountered a few servers that expect both parameters and a body, each
  with distinct semantic meaning, so the separation makes it much easier to
  translate into a request.

- Most of the time, path segments are treated individually, and URL-escaping
  the contents is much less error-prone. It also avoids being potentially
  lossy, and when the variable in question isn't trusted, escaping the path
  segment enables you to pass it through the URL and not risk being redirected
  to unexpected locations, avoiding some risks of vulnerabilities and client
  side crashes.

If you really don't care how the template and parameters translate to an
eventual URL, just pass the same object for the `params` and `body` and use
`:param...` for each segment. Either way, the more explicit nature should help
a lot in making the intent clearer, whether you care or not.
2019-05-29 09:28:40 -04:00
Isiah Meadows
b17b00e9eb
Drop ESM support (#2366)
* Drop ESM support

* Add `"unpkg"` field
2019-05-29 09:24:10 -04:00
Daniel Loomer
9b38e41fd6 standardize cdn links in docs (#2416)
- consistently use @next and explicit path
2019-05-27 11:58:11 -04:00
Rishabh Rawat
61af23de24 Adding fallback font-family sans-serif (#2411) 2019-05-14 13:52:56 -04:00
Oscar
6d36fe09d1 fix small typos (#2409)
Bootstrap FullCalandar Example -> Bootstrap FullCalendar Example
console.log('FullCalndar::oncreate') -> console.log('FullCalendar::oncreate')
2019-04-27 20:47:44 -04:00
Oscar
db0b5e26ba fix small typo (#2408)
m.route.params() -> m.route.param()
2019-04-23 06:59:08 -04:00
Isiah Meadows
000bb5aa55
Fix #2379 2019-04-17 14:30:46 -04:00
Ayush Jain
982fdf5737 Corrected the case issue of 'JavaScript' throughout the docs (#2401)
* corrected JavaScript spelling
2019-04-01 08:14:38 -04:00
Isiah
44fac6c4ca Bundled output for commit 0707de5867 [skip ci] 2019-03-09 07:06:45 +00:00
Isiah Meadows
0707de5867
Swap out keys so they use mine (#2393) 2019-03-09 02:04:30 -05:00
Gandalf-the-Bot
a154ace889 Bundled output for commit b0e4f4f2f8 [skip ci] 2019-03-02 07:38:55 +00:00
Isiah Meadows
b0e4f4f2f8 Run npm audit fix 2019-03-02 02:37:08 -05:00
Arun Cvf
853a54ae79 Fix mixed content error. (#2383)
Mixed Content: The page at 'https://cdn.rawgit.com/MithrilJS/mithril.js/master/examples/threaditjs/index.html' was loaded over HTTPS, but requested an insecure stylesheet 'http://threaditjs.com/reset.css'. This request has been blocked; the content must be served over HTTPS.
2019-03-02 02:22:39 -05:00
tebe
8e7f85f389 Fixed wrong setItem params (#2381) 2019-02-25 14:19:42 -05:00
Isiah Meadows
2010a0a71a Mithril now accepts donations through OpenCollective (#2363)
* Mithril now accepts donations through OpenCollective

* Include both backers and sponsors

* Add a contributing TOC, retitle page, fix a few links
2019-02-18 14:26:12 -05:00
Gandalf-the-Bot
9550730e99 Bundled output for commit ddec23efe7 [skip ci] 2019-02-18 19:24:58 +00:00
Isiah Meadows
ddec23efe7
Mithril now accepts donations through OpenCollective (#2363)
* Mithril now accepts donations through OpenCollective

* Include both backers and sponsors

* Add a contributing TOC, retitle page, fix a few links
2019-02-18 14:21:13 -05:00
Gandalf-the-Bot
621352fbd7 Bundled output for commit a9172f1129 [skip ci] 2019-02-07 10:14:46 +00:00
Yogesh Khatri
a9172f1129 Feature onmatch route param (#2371)
* added route param in onmatch

* fix docs

* included test

* docs fix
2019-02-07 05:12:53 -05:00
Isiah Meadows
6f8f011b88
Small typo fix (#2372) 2019-02-07 04:20:26 -05:00
Isiah Meadows
beb129c5fb Prepare ospec@3.1.0, mithril-stream@2.0.0
Also, correct the change logs to be much more consistent between each
other and ensure the ospec and stream change logs are linked to from
Mithril's primary change log.
2019-02-07 04:10:12 -05:00
Gandalf-the-Bot
b33f10d29b Bundled output for commit 7eea1b1e62 [skip ci] 2019-02-07 08:46:35 +00:00
Ivan Kupalov
7eea1b1e62 Fix Stream.end() (#2369) 2019-02-07 03:44:31 -05:00
Isiah Meadows
415862880d Forgot to revert ospec/package.json [skip ci] 2019-02-05 13:41:34 -05:00
Isiah Meadows
2ab559fdd0 Not updating ospec yet (I lack permissions) [skip ci] 2019-02-05 13:34:43 -05:00
Gandalf-the-Bot
194b767584 Bundled output for commit 99a61a09dc [skip ci] 2019-02-05 18:24:14 +00:00
Isiah Meadows
99a61a09dc
Update a few dependencies, update ospec to version 3.1.0 (#2370) 2019-02-05 13:20:55 -05:00
Isiah Meadows
02844a0b89 Fix version script [skip ci]
For some reason, it was never updated to include the stream bundle.
2019-02-05 11:40:42 -05:00
Isiah Meadows
c803918f00 v2.0.0-rc.4 2019-02-05 11:29:45 -05:00
Isiah Meadows
08feb1795e Fix linter error 2019-02-05 11:27:54 -05:00
Gandalf-the-Bot
de2e60acb3 Bundled output for commit 2a9b3964ca [skip ci] 2019-02-05 16:06:41 +00:00
Isiah Meadows
2a9b3964ca Fix the Stream.HALT warning's condition
Previously, it warned on all *but* the first use, which is obviously
wrong. This corrects it to correctly fire on only the first use.
2019-02-05 11:03:50 -05:00
Isiah Meadows
b91a10a233
s/mithril/mithril@next/g, add v1 docs link [skip ci] (#2368)
This should help point users to the correct version if they plan to
install the release candidate, and it should help users find the
existing docs for v1.
2019-02-02 11:01:51 -05:00
Gandalf-the-Bot
722a4f4af9 Bundled output for commit f30cf0afaa [skip ci] 2019-01-17 08:32:04 +00:00
Isiah Meadows
f30cf0afaa
Streams should be in ES5 2019-01-17 03:29:50 -05:00
Gandalf-the-Bot
ee232f00ff Bundled output for commit 23fe0a5ab1 [skip ci] 2019-01-10 04:12:06 +00:00
Adam Gamble
23fe0a5ab1 Fixed scan with skip (#2357)
* Fixed bad test for scan

The previous test didn't catch the fact that the accumulator had been
broke, it's value became the special value `SKIP`.

* Fixed Stream.scan() to accept SKIP value

* Update stream/stream.js

Dropped unnecessary ternary as suggested by @isiahmeadows

Co-Authored-By: gamb <adam@gamb.co>
2019-01-09 23:10:02 -05:00
Gandalf-the-Bot
65e2561c55 Bundled output for commit 39c20bdb34 [skip ci] 2019-01-07 09:58:33 +00:00