vite-plugin-debugger 0.0.8 → 0.0.10
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/LICENSE +21 -21
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -5
- package/package.json +1 -1
package/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2022 金华青鸟
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 金华青鸟
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
CHANGED
@@ -2,9 +2,9 @@ import { Plugin } from 'vite';
|
|
2
2
|
import { InitOptions } from 'eruda';
|
3
3
|
import { VConsoleOptions } from 'core/options.interface';
|
4
4
|
|
5
|
-
|
5
|
+
type CDN = 'jsdelivr' | 'unpkg' | 'cdnjs';
|
6
6
|
|
7
|
-
|
7
|
+
type ErudaPlugin = 'fps' | 'features' | 'timing' | 'memory' | 'code' | 'benchmark' | 'geolocation' | 'dom' | 'orientation' | 'touches';
|
8
8
|
interface ErudaConfig extends CommonConfig {
|
9
9
|
/**
|
10
10
|
* eruda options
|
package/dist/index.js
CHANGED
@@ -40,7 +40,7 @@ var transformCDN = (pkg, cdn) => {
|
|
40
40
|
if (cdn === "cdnjs") {
|
41
41
|
if (!Array.isArray(pkg)) {
|
42
42
|
if (pkg === "eruda") {
|
43
|
-
return "https://cdnjs.cloudflare.com/ajax/libs/eruda/2.
|
43
|
+
return "https://cdnjs.cloudflare.com/ajax/libs/eruda/2.10.0/eruda.min.js";
|
44
44
|
}
|
45
45
|
throw new Error(`[vite-plugin-debugger]: ${cdn} only support eruda without its plugins.`);
|
46
46
|
}
|
@@ -94,7 +94,10 @@ var transformErudaOptions = (html, opts) => {
|
|
94
94
|
tags.push({
|
95
95
|
tag: "script",
|
96
96
|
attrs: {
|
97
|
-
src: transformCDN(
|
97
|
+
src: transformCDN(
|
98
|
+
plugins.map((plugin) => `eruda-${plugin}`),
|
99
|
+
cdn
|
100
|
+
)
|
98
101
|
},
|
99
102
|
injectTo: "head"
|
100
103
|
});
|
@@ -147,7 +150,10 @@ var transformErudaImport = (code, opts) => {
|
|
147
150
|
return {
|
148
151
|
code: `/* eslint-disable */;
|
149
152
|
${importCode}
|
150
|
-
${debugInit(
|
153
|
+
${debugInit(
|
154
|
+
debug,
|
155
|
+
active
|
156
|
+
)}if(showDebug===true){${erudaScript}}
|
151
157
|
/* eslint-enable */
|
152
158
|
${code}`,
|
153
159
|
map: null
|
@@ -170,7 +176,9 @@ var transformVConsoleOptions = (html, opts) => {
|
|
170
176
|
tags.push({
|
171
177
|
tag: "script",
|
172
178
|
children: `${debugInit(debug, active)}
|
173
|
-
if(showDebug===true){var vConsole = new VConsole(${JSON.stringify(
|
179
|
+
if(showDebug===true){var vConsole = new VConsole(${JSON.stringify(
|
180
|
+
options || {}
|
181
|
+
)})};`,
|
174
182
|
injectTo: "head"
|
175
183
|
});
|
176
184
|
if (debug !== void 0) {
|
@@ -190,7 +198,10 @@ var transformVConsoleImport = (code, opts) => {
|
|
190
198
|
const { debug, active } = opts;
|
191
199
|
const { options = {} } = opts.vConsole;
|
192
200
|
return {
|
193
|
-
code: `/* eslint-disable */;import VConsole from 'vconsole'; ${debugInit(
|
201
|
+
code: `/* eslint-disable */;import VConsole from 'vconsole'; ${debugInit(
|
202
|
+
debug,
|
203
|
+
active
|
204
|
+
)}
|
194
205
|
if(showDebug===true){new VConsole(${JSON.stringify(options)})};/* eslint-enable */${code}`,
|
195
206
|
map: null
|
196
207
|
};
|