@modern-js/plugin-devtools 0.0.0-nightly-20240123170645 → 0.0.0-nightly-20240124170638
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/dist/cli.js +40 -11
- package/package.json +13 -13
package/dist/cli.js
CHANGED
@@ -34,10 +34,10 @@ __export(cli_exports, {
|
|
34
34
|
module.exports = __toCommonJS(cli_exports);
|
35
35
|
var import_http = __toESM(require("http"));
|
36
36
|
var import_path = __toESM(require("path"));
|
37
|
+
var import_assert = __toESM(require("assert"));
|
37
38
|
var import_utils = require("@modern-js/utils");
|
38
39
|
var import_serve_static = __toESM(require("serve-static"));
|
39
40
|
var import_devtools_kit = require("@modern-js/devtools-kit");
|
40
|
-
var import_ufo = require("ufo");
|
41
41
|
var import_config = require("./config");
|
42
42
|
var import_rpc = require("./rpc");
|
43
43
|
var import_socket = require("./utils/socket");
|
@@ -82,20 +82,47 @@ const devtoolsPlugin = (inlineOptions = {}) => ({
|
|
82
82
|
__keep: true
|
83
83
|
});
|
84
84
|
import_utils.logger.info(`${ctx.def.name.formalName} Devtools is enabled`);
|
85
|
-
const runtimeEntry = require.resolve("@modern-js/devtools-client/mount");
|
86
85
|
const swProxyEntry = require.resolve("@modern-js/devtools-client/sw-proxy");
|
86
|
+
const serializedOptions = JSON.stringify(ctx);
|
87
|
+
const tags = [
|
88
|
+
{
|
89
|
+
tag: "script",
|
90
|
+
children: `window.__MODERN_JS_DEVTOOLS_OPTIONS__ = ${serializedOptions};`,
|
91
|
+
head: true,
|
92
|
+
append: false
|
93
|
+
}
|
94
|
+
];
|
95
|
+
const styles = [];
|
96
|
+
const manifest = require("@modern-js/devtools-client/manifest");
|
97
|
+
for (const src of manifest.routeAssets.mount.assets) {
|
98
|
+
(0, import_assert.default)(typeof src === "string");
|
99
|
+
if (src.endsWith(".js")) {
|
100
|
+
tags.push({
|
101
|
+
tag: "script",
|
102
|
+
attrs: {
|
103
|
+
src
|
104
|
+
},
|
105
|
+
head: true,
|
106
|
+
append: false
|
107
|
+
});
|
108
|
+
} else if (src.endsWith(".css")) {
|
109
|
+
styles.push(src);
|
110
|
+
}
|
111
|
+
}
|
112
|
+
tags.push({
|
113
|
+
tag: "template",
|
114
|
+
attrs: {
|
115
|
+
id: "_modern_js_devtools_styles"
|
116
|
+
},
|
117
|
+
append: true,
|
118
|
+
head: false,
|
119
|
+
children: styles.map((src) => `<link rel="stylesheet" href="${src}">`).join("")
|
120
|
+
});
|
87
121
|
return {
|
88
122
|
builderPlugins: [
|
89
123
|
rpc.builderPlugin
|
90
124
|
],
|
91
|
-
source: {
|
92
|
-
preEntry: [
|
93
|
-
(0, import_ufo.withQuery)(runtimeEntry, ctx)
|
94
|
-
],
|
95
|
-
include: [
|
96
|
-
runtimeEntry
|
97
|
-
]
|
98
|
-
},
|
125
|
+
source: {},
|
99
126
|
output: {
|
100
127
|
copy: [
|
101
128
|
{
|
@@ -104,7 +131,9 @@ const devtoolsPlugin = (inlineOptions = {}) => ({
|
|
104
131
|
}
|
105
132
|
]
|
106
133
|
},
|
107
|
-
html: {
|
134
|
+
html: {
|
135
|
+
tags
|
136
|
+
},
|
108
137
|
tools: {
|
109
138
|
devServer: {
|
110
139
|
proxy: {
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "0.0.0-nightly-
|
18
|
+
"version": "0.0.0-nightly-20240124170638",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/index.d.ts",
|
21
21
|
"main": "./dist/index.js",
|
@@ -45,9 +45,9 @@
|
|
45
45
|
"p-defer": "^3.0.0",
|
46
46
|
"ws": "^8.13.0",
|
47
47
|
"ufo": "^1.3.0",
|
48
|
-
"@modern-js/devtools-kit": "0.0.0-nightly-
|
49
|
-
"@modern-js/devtools-client": "0.0.0-nightly-
|
50
|
-
"@modern-js/utils": "0.0.0-nightly-
|
48
|
+
"@modern-js/devtools-kit": "0.0.0-nightly-20240124170638",
|
49
|
+
"@modern-js/devtools-client": "0.0.0-nightly-20240124170638",
|
50
|
+
"@modern-js/utils": "0.0.0-nightly-20240124170638"
|
51
51
|
},
|
52
52
|
"devDependencies": {
|
53
53
|
"@types/serve-static": "^1.13.10",
|
@@ -56,17 +56,17 @@
|
|
56
56
|
"@types/ws": "^8.5.5",
|
57
57
|
"type-fest": "^4.1.0",
|
58
58
|
"typescript": "^5",
|
59
|
-
"@modern-js/
|
60
|
-
"@modern-js/
|
61
|
-
"@modern-js/module-tools": "0.0.0-nightly-
|
62
|
-
"@modern-js/runtime": "0.0.0-nightly-
|
63
|
-
"@modern-js/server-core": "0.0.0-nightly-
|
64
|
-
"@modern-js/types": "0.0.0-nightly-
|
65
|
-
"@
|
66
|
-
"@
|
59
|
+
"@modern-js/app-tools": "0.0.0-nightly-20240124170638",
|
60
|
+
"@modern-js/core": "0.0.0-nightly-20240124170638",
|
61
|
+
"@modern-js/module-tools": "0.0.0-nightly-20240124170638",
|
62
|
+
"@modern-js/runtime": "0.0.0-nightly-20240124170638",
|
63
|
+
"@modern-js/server-core": "0.0.0-nightly-20240124170638",
|
64
|
+
"@modern-js/types": "0.0.0-nightly-20240124170638",
|
65
|
+
"@scripts/build": "0.0.0-nightly-20240124170638",
|
66
|
+
"@modern-js/uni-builder": "0.0.0-nightly-20240124170638"
|
67
67
|
},
|
68
68
|
"peerDependencies": {
|
69
|
-
"@modern-js/runtime": "0.0.0-nightly-
|
69
|
+
"@modern-js/runtime": "0.0.0-nightly-20240124170638"
|
70
70
|
},
|
71
71
|
"peerDependenciesMeta": {
|
72
72
|
"@modern-js/runtime": {
|