@curtissimo/elm-hot 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG +40 -0
- package/CODE_OF_CONDUCT.md +74 -0
- package/CONTRIBUTING.md +51 -0
- package/LICENSE.txt +33 -0
- package/README.md +84 -0
- package/package.json +37 -0
- package/resources/hmr.js +519 -0
- package/src/index.js +6 -0
- package/src/inject.js +46 -0
- package/test/client.js +63 -0
- package/test/fixtures/BrowserApplicationCounter.elm +136 -0
- package/test/fixtures/BrowserApplicationCounter.html +22 -0
- package/test/fixtures/BrowserApplicationCounterDeepKey.elm +137 -0
- package/test/fixtures/BrowserApplicationCounterDeepKey.html +18 -0
- package/test/fixtures/BrowserApplicationCounterMultiKey.elm +158 -0
- package/test/fixtures/BrowserApplicationCounterMultiKey.html +22 -0
- package/test/fixtures/BrowserApplicationMissingNavKeyError.elm +62 -0
- package/test/fixtures/BrowserApplicationMissingNavKeyError.html +22 -0
- package/test/fixtures/BrowserApplicationNavKeyMoved.elm +159 -0
- package/test/fixtures/BrowserApplicationNavKeyMoved.html +22 -0
- package/test/fixtures/BrowserApplicationWithNull.elm +142 -0
- package/test/fixtures/BrowserApplicationWithNull.html +22 -0
- package/test/fixtures/BrowserDocumentCounter.elm +57 -0
- package/test/fixtures/BrowserDocumentCounter.html +24 -0
- package/test/fixtures/BrowserElementCounter.elm +55 -0
- package/test/fixtures/BrowserElementCounter.html +24 -0
- package/test/fixtures/BrowserSandboxCounter.elm +48 -0
- package/test/fixtures/BrowserSandboxCounter.html +21 -0
- package/test/fixtures/DebugBrowserApplication.elm +139 -0
- package/test/fixtures/DebugBrowserApplication.html +22 -0
- package/test/fixtures/DebugEmbed.elm +48 -0
- package/test/fixtures/DebugEmbed.html +21 -0
- package/test/fixtures/DebugFullscreen.elm +57 -0
- package/test/fixtures/DebugFullscreen.html +22 -0
- package/test/fixtures/FullScreenEmptyInit.elm +51 -0
- package/test/fixtures/FullScreenEmptyInit.html +19 -0
- package/test/fixtures/InitSideEffects.elm +65 -0
- package/test/fixtures/InitSideEffects.html +27 -0
- package/test/fixtures/MainWithTasks.elm +70 -0
- package/test/fixtures/MainWithTasks.html +21 -0
- package/test/fixtures/MultiMain.html +21 -0
- package/test/fixtures/MultiMain1.elm +48 -0
- package/test/fixtures/MultiMain2.elm +48 -0
- package/test/fixtures/PortsEmbed.elm +64 -0
- package/test/fixtures/PortsEmbed.html +27 -0
- package/test/fixtures/PortsFullscreen.elm +70 -0
- package/test/fixtures/PortsFullscreen.html +26 -0
- package/test/fixtures/build.sh +29 -0
- package/test/fixtures/elm.json +24 -0
- package/test/server.js +73 -0
- package/test/test.js +320 -0
- package/test.sh +16 -0
package/CHANGELOG
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.1.7
|
|
4
|
+
- Remove the use of `eval` in the code
|
|
5
|
+
- Format JavaScript files
|
|
6
|
+
- Fix warnings in Elm files
|
|
7
|
+
|
|
8
|
+
## 1.1.6
|
|
9
|
+
- more lenient search for Browser.Navigation.Key in the generated JS
|
|
10
|
+
- updated dependencies
|
|
11
|
+
|
|
12
|
+
## 1.1.5
|
|
13
|
+
- update dependencies
|
|
14
|
+
|
|
15
|
+
## 1.1.4
|
|
16
|
+
- fixed a bug where HMR failed because `Browser.Navigation.Key` changed location
|
|
17
|
+
- fixed a crash when the app's `Model` contains `Json.Encode.null`
|
|
18
|
+
|
|
19
|
+
## 1.1.3
|
|
20
|
+
- fixed a crash when using Elm debugger and elm/browser 1.0.2
|
|
21
|
+
|
|
22
|
+
## 1.1.2
|
|
23
|
+
- fixed a bug where HMR would not work for very small ("toy") Elm projects
|
|
24
|
+
|
|
25
|
+
## 1.1.1
|
|
26
|
+
- added support for Elm 0.19.1
|
|
27
|
+
|
|
28
|
+
## 1.0.1
|
|
29
|
+
- bug fixes
|
|
30
|
+
|
|
31
|
+
## 1.0.0
|
|
32
|
+
- improved Browser.application support (Browser.Navigation.Key can be stored
|
|
33
|
+
anywhere in your model now)
|
|
34
|
+
|
|
35
|
+
## 0.9.1
|
|
36
|
+
- separated the Webpack loader out into its own package
|
|
37
|
+
- exposed core API
|
|
38
|
+
|
|
39
|
+
## 0.9.0
|
|
40
|
+
- first release
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of
|
|
9
|
+
experience, education, socio-economic status, nationality, personal appearance,
|
|
10
|
+
race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
|
41
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
42
|
+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
|
|
43
|
+
contributor for other behaviors that they deem inappropriate, threatening,
|
|
44
|
+
offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at coc@curtissimo.com. All complaints
|
|
59
|
+
will be reviewed and investigated and will result in a response that is deemed
|
|
60
|
+
necessary and appropriate to the circumstances. The project team is obligated to
|
|
61
|
+
maintain confidentiality with regard to the reporter of an incident. Further
|
|
62
|
+
details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
71
|
+
version 1.4, available at
|
|
72
|
+
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
73
|
+
|
|
74
|
+
[homepage]: https://www.contributor-covenant.org
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Welcome, we really appreciate if you're considering to contribute, the joint
|
|
4
|
+
effort of our contributors make projects like this possible!
|
|
5
|
+
|
|
6
|
+
The goal of this document is to provide guidance on how you can get involved.
|
|
7
|
+
|
|
8
|
+
## Asking questions
|
|
9
|
+
|
|
10
|
+
Have a question or feature request? Feel free to open a new issue on the
|
|
11
|
+
[Issue](https://gitlab.com/curtissimo/elm-hot/-/issues) board.
|
|
12
|
+
|
|
13
|
+
Please be polite and take the time to write a well-worded request or question so
|
|
14
|
+
our community members can easily assist you.
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
Before starting make sure you have the following installed:
|
|
19
|
+
|
|
20
|
+
- [git](https://git-scm.com)
|
|
21
|
+
- [Node](https://nodejs.org) at LTS (with NPM)
|
|
22
|
+
|
|
23
|
+
## Pull requests
|
|
24
|
+
|
|
25
|
+
For significant changes, it is recommended that you first [propose your
|
|
26
|
+
solution](https://gitlab.com/curtissimo/elm-hot/-/issues) and gather feedback.
|
|
27
|
+
|
|
28
|
+
**Before submitting a pull request,** you can follow this step by step guide:
|
|
29
|
+
|
|
30
|
+
1. [Fork](https://docs.gitlab.com/user/project/repository/forking_workflow/)
|
|
31
|
+
the repository and setup a new branch to work in.
|
|
32
|
+
1. [Create a new
|
|
33
|
+
branch](https://docs.gitlab.com/user/project/repository/branches/#create-a-branch∑)
|
|
34
|
+
for your changes.
|
|
35
|
+
2. Run `npm install` to install dependencies.
|
|
36
|
+
3. If you fix a bug or introduce a new feature, add tests or ask for help if the
|
|
37
|
+
use-case is more complex.
|
|
38
|
+
4. Commit the `package-lock.json` file if it has changed.
|
|
39
|
+
|
|
40
|
+
⚠️ Don't modify the `package.json` versioning
|
|
41
|
+
|
|
42
|
+
Once you are ready to create a pull request, provide relevant details about the
|
|
43
|
+
change; examples; and test cases. All submissions require review, so please be
|
|
44
|
+
patient!
|
|
45
|
+
|
|
46
|
+
## Credits
|
|
47
|
+
|
|
48
|
+
### Contributors
|
|
49
|
+
|
|
50
|
+
Thanks to [Keith Lazuka](https://github.com/klazuka) (GitHub) for intitially
|
|
51
|
+
creating this.
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Copyright 2018 Keith Lazuka
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
+
|
|
9
|
+
---------------------------------------
|
|
10
|
+
|
|
11
|
+
Based on fluxxu/elm-hot-loader (https://github.com/fluxxu/elm-hot-loader)
|
|
12
|
+
|
|
13
|
+
The MIT License (MIT)
|
|
14
|
+
|
|
15
|
+
Copyright (c) 2016 Flux Xu
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @curtissimo/elm-hot
|
|
2
|
+
|
|
3
|
+
This package provides the core infrastructure needed for doing hot code swapping
|
|
4
|
+
in Elm. It supports Elm 0.19.0 and 0.19.1 only.
|
|
5
|
+
|
|
6
|
+
**This low-level package is intended for authors of Elm application servers.**
|
|
7
|
+
|
|
8
|
+
This package is primarily maintained for use with
|
|
9
|
+
[Parcel](https://parceljs.org/) and its [built-in support for
|
|
10
|
+
Elm](https://parceljs.org/elm.html) which uses this package.
|
|
11
|
+
|
|
12
|
+
The goal of this package is to provide a reusable core that can be used to
|
|
13
|
+
provide hot code swapping support in a variety of environments.
|
|
14
|
+
|
|
15
|
+
### Installing `elm-hot` core API
|
|
16
|
+
|
|
17
|
+
This really should only be a development dependency.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
$ npm install --save-dev elm-hot
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
-------------------------------------------
|
|
24
|
+
|
|
25
|
+
### Testing
|
|
26
|
+
|
|
27
|
+
These tests run against both Elm 0.19.0 and 0.19.1. Switching out binaries
|
|
28
|
+
and modifying the `elm.json` file is a little bit of a chore, but do-able.
|
|
29
|
+
|
|
30
|
+
These integration tests are _sloooooow_, like it takes five minutes slow.
|
|
31
|
+
|
|
32
|
+
Our goals with testing are:
|
|
33
|
+
|
|
34
|
+
- Provide dockerized testing environments to isolate the various versions of the
|
|
35
|
+
Elm compiler
|
|
36
|
+
- Increase the speed of the tests because ... well, five minutes ... that's a
|
|
37
|
+
long time
|
|
38
|
+
|
|
39
|
+
-------------------------------------------
|
|
40
|
+
|
|
41
|
+
### Core API
|
|
42
|
+
|
|
43
|
+
**`function inject(str)`**
|
|
44
|
+
|
|
45
|
+
Injects the hot code swapping functionality into a compiled Elm app.
|
|
46
|
+
|
|
47
|
+
- Takes the Javascript code emitted by the Elm compiler as an input string
|
|
48
|
+
- Returns a string containing the injected code ready to be evaluated in the
|
|
49
|
+
browser.
|
|
50
|
+
|
|
51
|
+
### Example of how the core API could be used
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
const elmHot = require('elm-hot');
|
|
55
|
+
const {compileToStringSync} = require('node-elm-compiler');
|
|
56
|
+
const injectedCode = elmHot.inject(compileToStringSync(["src/Main.elm"], {}));
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
In order to provide something similar to `webpack-dev-server` with hot module
|
|
60
|
+
reloading, an application server could be developed to do the following:
|
|
61
|
+
|
|
62
|
+
- Serve a modified version of the developer's `index.html` to receive push
|
|
63
|
+
events from the server
|
|
64
|
+
- Watch `.elm` files on disk for changes
|
|
65
|
+
- Push a "file changed" event to the client notifying it that it should fetch
|
|
66
|
+
new code from the server
|
|
67
|
+
- When the client receives the event:
|
|
68
|
+
- Fetch the new code (the server will re-compile the Elm code and use
|
|
69
|
+
`elm-hot` to inject the hot-code-swapping logic)
|
|
70
|
+
- The client deletes the old `Elm` object and injects the new code
|
|
71
|
+
from the server
|
|
72
|
+
|
|
73
|
+
Keith Lazuka implemented something similar to this for the integration tests.
|
|
74
|
+
See [test/server.js]() and [test/client.js]() for inspiration.
|
|
75
|
+
|
|
76
|
+
-------------------------------------------
|
|
77
|
+
|
|
78
|
+
### Attribution
|
|
79
|
+
|
|
80
|
+
This is an active fork of Keith Lazuka's
|
|
81
|
+
[elm-hot](https://github.com/klazuka/elm-hot/) GitHub repository.
|
|
82
|
+
|
|
83
|
+
Elm hot code swapping is based on the work of Flux Xu's
|
|
84
|
+
[elm-hot-loader](https://github.com/fluxxu/elm-hot-loader).
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@curtissimo/elm-hot",
|
|
3
|
+
"version": "1.1.7",
|
|
4
|
+
"description": "Hot code swapping for Elm",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Elm",
|
|
7
|
+
"HMR",
|
|
8
|
+
"hot",
|
|
9
|
+
"reload"
|
|
10
|
+
],
|
|
11
|
+
"author": "Keith Lazuka",
|
|
12
|
+
"maintainers": [
|
|
13
|
+
"Curtis Schlak <696163-realistschuckle@users.noreply.gitlab.com>"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://gitlab.com/curtissimo/elm-hot.git"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"main": "src/index.js",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"test": "./test.sh"
|
|
23
|
+
},
|
|
24
|
+
"ava": {
|
|
25
|
+
"files": [
|
|
26
|
+
"test/test.js"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"ava": "^6.4.1",
|
|
31
|
+
"chokidar": "^5.0.0",
|
|
32
|
+
"elm-format": "^0.8.8",
|
|
33
|
+
"express": "^5.2.1",
|
|
34
|
+
"puppeteer": "^24.34.0",
|
|
35
|
+
"tap-xunit": "^2.4.1"
|
|
36
|
+
}
|
|
37
|
+
}
|