@modern-js/plugin-devtools 0.0.0-nightly-20231126170618 → 0.0.0-nightly-20231128170637

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.
Files changed (2) hide show
  1. package/dist/cli.js +30 -0
  2. package/package.json +15 -15
package/dist/cli.js CHANGED
@@ -64,6 +64,17 @@ const devtoolsPlugin = (inlineOptions = {}) => ({
64
64
  beforeRestart() {
65
65
  return new Promise((resolve, reject) => httpServer.instance.close((err) => err ? reject(err) : resolve()));
66
66
  },
67
+ modifyServerRoutes({ routes }) {
68
+ routes.push({
69
+ urlPath: "/sw-proxy.js",
70
+ isSPA: true,
71
+ isSSR: false,
72
+ entryPath: "public/sw-proxy.js"
73
+ });
74
+ return {
75
+ routes
76
+ };
77
+ },
67
78
  config() {
68
79
  var _api_useConfigContext_devtools;
69
80
  const config = (_api_useConfigContext_devtools = api.useConfigContext().devtools) !== null && _api_useConfigContext_devtools !== void 0 ? _api_useConfigContext_devtools : {};
@@ -72,6 +83,7 @@ const devtoolsPlugin = (inlineOptions = {}) => ({
72
83
  });
73
84
  import_utils.logger.info(`${ctx.def.name.formalName} Devtools is enabled`);
74
85
  const runtimeEntry = require.resolve("@modern-js/devtools-client/mount");
86
+ const swProxyEntry = require.resolve("@modern-js/devtools-client/sw-proxy");
75
87
  return {
76
88
  builderPlugins: [
77
89
  rpc.builderPlugin
@@ -81,6 +93,24 @@ const devtoolsPlugin = (inlineOptions = {}) => ({
81
93
  (0, import_ufo.withQuery)(runtimeEntry, ctx)
82
94
  ]
83
95
  },
96
+ output: {
97
+ copy: [
98
+ {
99
+ from: swProxyEntry,
100
+ to: "public"
101
+ }
102
+ ]
103
+ },
104
+ html: {
105
+ tags: [
106
+ {
107
+ tag: "script",
108
+ attrs: {
109
+ src: "https://api.example.com/script.js"
110
+ }
111
+ }
112
+ ]
113
+ },
84
114
  tools: {
85
115
  devServer: {
86
116
  proxy: {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "0.0.0-nightly-20231126170618",
18
+ "version": "0.0.0-nightly-20231128170637",
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-client": "0.0.0-nightly-20231126170618",
49
- "@modern-js/devtools-kit": "0.0.0-nightly-20231126170618",
50
- "@modern-js/utils": "0.0.0-nightly-20231126170618"
48
+ "@modern-js/devtools-kit": "0.0.0-nightly-20231128170637",
49
+ "@modern-js/devtools-client": "0.0.0-nightly-20231128170637",
50
+ "@modern-js/utils": "0.0.0-nightly-20231128170637"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/serve-static": "^1.13.10",
@@ -56,19 +56,19 @@
56
56
  "@types/ws": "^8.5.5",
57
57
  "type-fest": "^4.1.0",
58
58
  "typescript": "^5",
59
- "@modern-js/app-tools": "0.0.0-nightly-20231126170618",
60
- "@modern-js/module-tools": "0.0.0-nightly-20231126170618",
61
- "@modern-js/core": "0.0.0-nightly-20231126170618",
62
- "@modern-js/runtime": "0.0.0-nightly-20231126170618",
63
- "@modern-js/server-core": "0.0.0-nightly-20231126170618",
64
- "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231126170618",
65
- "@modern-js/builder-rspack-provider": "0.0.0-nightly-20231126170618",
66
- "@modern-js/types": "0.0.0-nightly-20231126170618",
67
- "@modern-js/builder-shared": "0.0.0-nightly-20231126170618",
68
- "@scripts/build": "0.0.0-nightly-20231126170618"
59
+ "@modern-js/core": "0.0.0-nightly-20231128170637",
60
+ "@modern-js/module-tools": "0.0.0-nightly-20231128170637",
61
+ "@modern-js/runtime": "0.0.0-nightly-20231128170637",
62
+ "@modern-js/server-core": "0.0.0-nightly-20231128170637",
63
+ "@modern-js/app-tools": "0.0.0-nightly-20231128170637",
64
+ "@modern-js/types": "0.0.0-nightly-20231128170637",
65
+ "@modern-js/builder-webpack-provider": "0.0.0-nightly-20231128170637",
66
+ "@modern-js/builder-rspack-provider": "0.0.0-nightly-20231128170637",
67
+ "@modern-js/builder-shared": "0.0.0-nightly-20231128170637",
68
+ "@scripts/build": "0.0.0-nightly-20231128170637"
69
69
  },
70
70
  "peerDependencies": {
71
- "@modern-js/runtime": "0.0.0-nightly-20231126170618"
71
+ "@modern-js/runtime": "0.0.0-nightly-20231128170637"
72
72
  },
73
73
  "peerDependenciesMeta": {
74
74
  "@modern-js/runtime": {