@jsenv/core 38.2.4 → 38.2.6
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/README.md +54 -16
- package/dist/jsenv_core.js +7 -5
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @jsenv/core [](https://www.npmjs.com/package/@jsenv/core)
|
|
2
2
|
|
|
3
|
-
Jsenv is a tool to develop test and build projects using JavaScript. Jsenv is simple, easy to understand and well
|
|
3
|
+
Jsenv is a tool to develop test and build projects using JavaScript. Jsenv is simple, easy to understand and well documented.
|
|
4
4
|
|
|
5
5
|
Jsenv cares a lot about the developper experience, especially when it comes to tests.
|
|
6
6
|
|
|
@@ -11,21 +11,11 @@ The pillars of jsenv are:
|
|
|
11
11
|
3. A build server serving build files
|
|
12
12
|
4. A test runner executing test files in web browser(s)
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## Reduce cognitive load inside test files
|
|
17
|
-
|
|
18
|
-
When coding, we spend most of our time working on source files. At some point we switch from source files to test files. Suddenly things are different:
|
|
14
|
+
[Link to documentation](<https://github.com/jsenv/core/wiki/A)-directory-structure>)
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
- some tools are used differently in test files, some cannot be used at all
|
|
22
|
-
- you are forced to code in a certain way that is completely different from the one in source files
|
|
23
|
-
|
|
24
|
-
This huge gap between source files and test files creates a context switching costing a lot of cognitive energy.
|
|
25
|
-
Jsenv makes a special effort to [provide a solution](<https://github.com/jsenv/core/wiki/D)-Test>) where switching from source files to test files is easy.
|
|
26
|
-
|
|
27
|
-
## Others
|
|
16
|
+
# The best parts
|
|
28
17
|
|
|
18
|
+
- Tools and habits used in source files [can be reused in test files](<https://github.com/jsenv/core/wiki/D)-Test>).
|
|
29
19
|
- A [large browser support during dev](<https://github.com/jsenv/core/wiki/B)-Dev#21-browser-support>). Because some people might be happy to use an other browser than the latest chrome during dev. Moreover it is useful to reproduce bug specific to certain browsers.
|
|
30
20
|
- A [large browser support after build](<https://github.com/jsenv/core/wiki/C)-Build#211-maximal-browser-support>). Because some product still needs to support old versions of Firefox, Chrome and Safari.
|
|
31
21
|
- A [single set of files during build](<https://github.com/jsenv/core/wiki/C)-Build#212-same-build-for-all-browsers>). Because a single one is simpler to properly support in every aspects.
|
|
@@ -33,11 +23,59 @@ Jsenv makes a special effort to [provide a solution](<https://github.com/jsenv/c
|
|
|
33
23
|
- Ability to [execute tests in multiple browsers](<https://github.com/jsenv/core/wiki/D)-Test#32-executing-on-more-browsers>): Chrome, Safari, Firefox
|
|
34
24
|
- An advanced support of top level await, allowing to use it everywhere
|
|
35
25
|
- An advanced support of web workers including worker type module
|
|
36
|
-
- Unlock js module features on a regular `<script>` when needed. If you need the behaviour of `<script>` which is to block
|
|
26
|
+
- Unlock js module features on a regular `<script>` when needed. If you need the behaviour of `<script>` which is to block execution of following `<script>` in the page, you'll be happy to [still have the power of js modules](<https://github.com/jsenv/core/wiki/G)-Plugins#22-asjsclassic>), like imports, at your disposal.
|
|
37
27
|
|
|
38
28
|
# Demos
|
|
39
29
|
|
|
40
|
-
|
|
30
|
+
A demo is a project pre-configured with jsenv.
|
|
31
|
+
|
|
32
|
+
The following command can be used to install and try a demo:
|
|
33
|
+
|
|
34
|
+
```console
|
|
35
|
+
npm create jsenv@latest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
It will prompt to choose one of the available demo:
|
|
39
|
+
|
|
40
|
+
```console
|
|
41
|
+
? Select a demo: › - Use arrow-keys. Return to submit.
|
|
42
|
+
❯ web
|
|
43
|
+
web-react
|
|
44
|
+
web-preact
|
|
45
|
+
node-package
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Selecting "web" will copy [create-jsenv/demo-web](https://github.com/jsenv/core/tree/bc7fb0aa2c8ced1db4d7583a2ea1858be464c23b/packages/related/create-jsenv/demo-web) files into a directory:
|
|
49
|
+
|
|
50
|
+
```console
|
|
51
|
+
✔ Select a demo: › web
|
|
52
|
+
✔ copy demo files into "[...]jsenv-demo-web/" (done in 0.1 second)
|
|
53
|
+
----- commands to run -----
|
|
54
|
+
cd jsenv-demo-web
|
|
55
|
+
npm install
|
|
56
|
+
npm start
|
|
57
|
+
---------------------------
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
After running the suggested commands the demo is ready.
|
|
61
|
+
|
|
62
|
+
The demo contains preconfigured scripts:
|
|
63
|
+
|
|
64
|
+
- `npm run dev`: starts a server for source files; Documented in [B) Dev](<https://github.com/jsenv/core/wiki/B)-Dev>).
|
|
65
|
+
- `npm run build`: generate files optimized for production; Documented in [C) Build](<https://github.com/jsenv/core/wiki/C)-Build>).
|
|
66
|
+
- `npm run build:serve`: start a server for build files; Documented in [C) Build#how-to-serve-build-files](<https://github.com/jsenv/core/wiki/C)-Build#3-how-to-serve-build-files>).
|
|
67
|
+
- `npm run test`: execute test files on browsers(s); Documented in [D) Test](<https://github.com/jsenv/core/wiki/D)-Test>).
|
|
68
|
+
|
|
69
|
+
<!--
|
|
70
|
+
The following commands can be used to skip the prompt
|
|
71
|
+
|
|
72
|
+
| Command |
|
|
73
|
+
| ------------------------------------------- |
|
|
74
|
+
| `npm create jsenv@latest -- --web` |
|
|
75
|
+
| `npm create jsenv@latest -- --web-preact` |
|
|
76
|
+
| `npm create jsenv@latest -- --web-react` |
|
|
77
|
+
| `npm create jsenv@latest -- --node-package` |
|
|
78
|
+
-->
|
|
41
79
|
|
|
42
80
|
<!-- # Installation
|
|
43
81
|
|
package/dist/jsenv_core.js
CHANGED
|
@@ -2545,7 +2545,8 @@ callback: ${callback}`);
|
|
|
2545
2545
|
return { registerCleanupCallback, cleanup };
|
|
2546
2546
|
};
|
|
2547
2547
|
|
|
2548
|
-
const
|
|
2548
|
+
const isLinux = process.platform === "linux";
|
|
2549
|
+
const fsWatchSupportsRecursive = !isLinux;
|
|
2549
2550
|
|
|
2550
2551
|
const registerDirectoryLifecycle = (
|
|
2551
2552
|
source,
|
|
@@ -2881,10 +2882,10 @@ const shouldCallUpdated = (entryInfo) => {
|
|
|
2881
2882
|
if (stat.atimeMs < stat.mtimeMs) {
|
|
2882
2883
|
return true;
|
|
2883
2884
|
}
|
|
2884
|
-
if (stat.mtimeMs
|
|
2885
|
-
return
|
|
2885
|
+
if (isLinux && stat.mtimeMs <= previousInfo.stat.mtimeMs) {
|
|
2886
|
+
return false;
|
|
2886
2887
|
}
|
|
2887
|
-
return
|
|
2888
|
+
return true;
|
|
2888
2889
|
};
|
|
2889
2890
|
|
|
2890
2891
|
const undefinedOrFunction = (value) => {
|
|
@@ -3856,6 +3857,7 @@ const createLog = ({
|
|
|
3856
3857
|
write,
|
|
3857
3858
|
dynamicWrite,
|
|
3858
3859
|
destroy,
|
|
3860
|
+
stream,
|
|
3859
3861
|
});
|
|
3860
3862
|
return log;
|
|
3861
3863
|
};
|
|
@@ -3890,7 +3892,7 @@ const startSpinner = ({
|
|
|
3890
3892
|
stopOnVerticalOverflow = true,
|
|
3891
3893
|
render = () => "",
|
|
3892
3894
|
effect = () => {},
|
|
3893
|
-
animated =
|
|
3895
|
+
animated = log.stream.isTTY,
|
|
3894
3896
|
}) => {
|
|
3895
3897
|
let frameIndex = 0;
|
|
3896
3898
|
let interval;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "38.2.
|
|
3
|
+
"version": "38.2.6",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -62,16 +62,16 @@
|
|
|
62
62
|
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
|
|
63
63
|
"@jsenv/abort": "4.2.4",
|
|
64
64
|
"@jsenv/ast": "5.1.4",
|
|
65
|
-
"@jsenv/filesystem": "4.3.
|
|
65
|
+
"@jsenv/filesystem": "4.3.2",
|
|
66
66
|
"@jsenv/importmap": "1.2.1",
|
|
67
67
|
"@jsenv/integrity": "0.0.1",
|
|
68
|
-
"@jsenv/log": "3.4.
|
|
68
|
+
"@jsenv/log": "3.4.1",
|
|
69
69
|
"@jsenv/node-esm-resolution": "1.0.1",
|
|
70
70
|
"@jsenv/js-module-fallback": "1.3.5",
|
|
71
71
|
"@jsenv/runtime-compat": "1.2.0",
|
|
72
|
-
"@jsenv/server": "15.1.
|
|
72
|
+
"@jsenv/server": "15.1.3",
|
|
73
73
|
"@jsenv/sourcemap": "1.2.3",
|
|
74
|
-
"@jsenv/plugin-bundling": "2.5.
|
|
74
|
+
"@jsenv/plugin-bundling": "2.5.5",
|
|
75
75
|
"@jsenv/plugin-minification": "1.5.2",
|
|
76
76
|
"@jsenv/plugin-transpilation": "1.3.4",
|
|
77
77
|
"@jsenv/plugin-supervisor": "1.3.4",
|