@jsenv/plugin-supervisor 1.0.0 → 1.1.0
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
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
This plugin has its own package because:
|
|
2
|
+
|
|
3
|
+
- It's a direct dependency of `@jsenv/core` but it is easier to reason about this code when its properly splitted in its own package
|
|
4
|
+
- `@jsenv/test` use most of the logic of this plugin. Having a dedicated NPM package allow to reuse that code without creating a direct dependency between `@jsenv/test` and `@jsenv/core`.
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-supervisor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/jsenv/core",
|
|
8
|
-
"directory": "packages/
|
|
8
|
+
"directory": "packages/internal/plugin-supervisor"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
16
|
"import": {
|
|
17
|
-
"development": "./src/
|
|
17
|
+
"development": "./src/main.js",
|
|
18
18
|
"default": "./dist/jsenv_plugin_supervisor.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"/src/"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@jsenv/ast": "4.0.
|
|
28
|
+
"@jsenv/ast": "4.0.3",
|
|
29
29
|
"@jsenv/urls": "2.0.0",
|
|
30
30
|
"@jsenv/sourcemap": "1.0.10",
|
|
31
31
|
"launch-editor": "2.6.0"
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"scripts": {
|
|
34
34
|
"eslint": "npx eslint . --ext=.js,.mjs,.cjs,.html",
|
|
35
35
|
"build": "node ./scripts/build.mjs",
|
|
36
|
+
"test": "node ./scripts/test.mjs",
|
|
36
37
|
"prepublishOnly": "npm run build"
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
} from "@jsenv/ast";
|
|
61
61
|
import { generateInlineContentUrl, urlToRelativeUrl } from "@jsenv/urls";
|
|
62
62
|
|
|
63
|
-
import { injectSupervisorIntoJs } from "./
|
|
63
|
+
import { injectSupervisorIntoJs } from "./js_supervisor.js";
|
|
64
64
|
|
|
65
65
|
export const supervisorFileUrl = new URL(
|
|
66
66
|
"./client/supervisor.js",
|
|
@@ -52,12 +52,10 @@ export const injectSupervisorIntoJs = async ({
|
|
|
52
52
|
? babelPluginJsModuleSupervisor
|
|
53
53
|
: babelPluginJsClassicSupervisor;
|
|
54
54
|
const result = await applyBabelPlugins({
|
|
55
|
-
urlInfo: {
|
|
56
|
-
content,
|
|
57
|
-
originalUrl: url,
|
|
58
|
-
type,
|
|
59
|
-
},
|
|
60
55
|
babelPlugins: [[babelPluginJsSupervisor, { inlineSrc }]],
|
|
56
|
+
input: content,
|
|
57
|
+
inputIsJsModule: type === "js_module",
|
|
58
|
+
inputUrl: url,
|
|
61
59
|
});
|
|
62
60
|
let code = result.code;
|
|
63
61
|
let map = result.map;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* This plugin provides a way for jsenv to
|
|
2
|
+
* This plugin provides a way for jsenv to supervisor js execution:
|
|
3
|
+
* - Know how many js are executed, when they are done, collect errors, etc...
|
|
3
4
|
*/
|
|
4
5
|
|
|
5
6
|
import { createRequire } from "node:module";
|
|
@@ -7,12 +8,10 @@ import { fileURLToPath } from "node:url";
|
|
|
7
8
|
import { getOriginalPosition } from "@jsenv/sourcemap";
|
|
8
9
|
import { stringifyUrlSite } from "@jsenv/urls";
|
|
9
10
|
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import.meta.url,
|
|
15
|
-
).href;
|
|
11
|
+
import {
|
|
12
|
+
supervisorFileUrl,
|
|
13
|
+
injectSupervisorIntoHTML,
|
|
14
|
+
} from "./html_supervisor.js";
|
|
16
15
|
|
|
17
16
|
export const jsenvPluginSupervisor = ({
|
|
18
17
|
logs = false,
|