wxt 0.18.6 → 0.18.8
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/{chunk-5X3S6AWF.js → chunk-BERPNPEZ.js} +2 -4
- package/dist/{chunk-ZZCTFNQ5.js → chunk-BM6QYGAW.js} +1 -1
- package/dist/{chunk-NAMV4VWQ.js → chunk-KPD5J7PZ.js} +1 -1
- package/dist/{chunk-VBXJIVYU.js → chunk-QGM4M3NI.js} +1 -2
- package/dist/{chunk-73I7FAJU.js → chunk-SGKCDMVR.js} +1 -2
- package/dist/{chunk-QOYT5J6A.js → chunk-Z3C7S5VV.js} +117 -182
- package/dist/cli.js +139 -220
- package/dist/client.js +12 -24
- package/dist/{execa-QQUOQNS3.js → execa-ATHZH2Y4.js} +1576 -610
- package/dist/{execa-5TSWMF32.js → execa-D7CMCKO2.js} +1576 -610
- package/dist/index.cjs +2182 -1180
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +24 -38
- package/dist/modules.cjs +8 -12
- package/dist/modules.js +9 -13
- package/dist/{prompt-Y7B5HSD5.js → prompt-25QIVJDC.js} +28 -55
- package/dist/{prompt-TFJ7OLL7.js → prompt-7BMKNSWS.js} +28 -55
- package/dist/sandbox.js +2 -4
- package/dist/storage.cjs +4 -8
- package/dist/storage.js +6 -10
- package/dist/testing.cjs +35 -69
- package/dist/testing.js +4 -4
- package/dist/virtual/background-entrypoint.js +46 -36
- package/dist/virtual/content-script-isolated-world-entrypoint.js +1 -2
- package/dist/virtual/content-script-main-world-entrypoint.js +1 -2
- package/dist/virtual/reload-html.js +38 -31
- package/dist/virtual/unlisted-script-entrypoint.js +1 -2
- package/package.json +33 -32
package/dist/client.js
CHANGED
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
|
|
5
5
|
// src/sandbox/utils/logger.ts
|
|
6
6
|
function print(method, ...args) {
|
|
7
|
-
if (import.meta.env.MODE === "production")
|
|
8
|
-
return;
|
|
7
|
+
if (import.meta.env.MODE === "production") return;
|
|
9
8
|
if (typeof args[0] === "string") {
|
|
10
9
|
const message = args.shift();
|
|
11
10
|
method(`[wxt] ${message}`, ...args);
|
|
@@ -44,8 +43,7 @@ function createLocationWatcher(ctx) {
|
|
|
44
43
|
* this is a noop.
|
|
45
44
|
*/
|
|
46
45
|
run() {
|
|
47
|
-
if (interval != null)
|
|
48
|
-
return;
|
|
46
|
+
if (interval != null) return;
|
|
49
47
|
oldUrl = new URL(location.href);
|
|
50
48
|
interval = ctx.setInterval(() => {
|
|
51
49
|
let newUrl = new URL(location.href);
|
|
@@ -127,8 +125,7 @@ var ContentScriptContext = class _ContentScriptContext {
|
|
|
127
125
|
*/
|
|
128
126
|
setInterval(handler, timeout) {
|
|
129
127
|
const id = setInterval(() => {
|
|
130
|
-
if (this.isValid)
|
|
131
|
-
handler();
|
|
128
|
+
if (this.isValid) handler();
|
|
132
129
|
}, timeout);
|
|
133
130
|
this.onInvalidated(() => clearInterval(id));
|
|
134
131
|
return id;
|
|
@@ -138,8 +135,7 @@ var ContentScriptContext = class _ContentScriptContext {
|
|
|
138
135
|
*/
|
|
139
136
|
setTimeout(handler, timeout) {
|
|
140
137
|
const id = setTimeout(() => {
|
|
141
|
-
if (this.isValid)
|
|
142
|
-
handler();
|
|
138
|
+
if (this.isValid) handler();
|
|
143
139
|
}, timeout);
|
|
144
140
|
this.onInvalidated(() => clearTimeout(id));
|
|
145
141
|
return id;
|
|
@@ -150,8 +146,7 @@ var ContentScriptContext = class _ContentScriptContext {
|
|
|
150
146
|
*/
|
|
151
147
|
requestAnimationFrame(callback) {
|
|
152
148
|
const id = requestAnimationFrame((...args) => {
|
|
153
|
-
if (this.isValid)
|
|
154
|
-
callback(...args);
|
|
149
|
+
if (this.isValid) callback(...args);
|
|
155
150
|
});
|
|
156
151
|
this.onInvalidated(() => cancelAnimationFrame(id));
|
|
157
152
|
return id;
|
|
@@ -162,8 +157,7 @@ var ContentScriptContext = class _ContentScriptContext {
|
|
|
162
157
|
*/
|
|
163
158
|
requestIdleCallback(callback, options) {
|
|
164
159
|
const id = requestIdleCallback((...args) => {
|
|
165
|
-
if (!this.signal.aborted)
|
|
166
|
-
callback(...args);
|
|
160
|
+
if (!this.signal.aborted) callback(...args);
|
|
167
161
|
}, options);
|
|
168
162
|
this.onInvalidated(() => cancelIdleCallback(id));
|
|
169
163
|
return id;
|
|
@@ -187,8 +181,7 @@ var ContentScriptContext = class _ContentScriptContext {
|
|
|
187
181
|
*/
|
|
188
182
|
addEventListener(target, type, handler, options) {
|
|
189
183
|
if (type === "wxt:locationchange") {
|
|
190
|
-
if (this.isValid)
|
|
191
|
-
this.#locationWatcher.run();
|
|
184
|
+
if (this.isValid) this.#locationWatcher.run();
|
|
192
185
|
}
|
|
193
186
|
target.addEventListener?.(
|
|
194
187
|
type.startsWith("wxt:") ? getUniqueEventName(type) : type,
|
|
@@ -329,10 +322,8 @@ async function createShadowRootUi(ctx, options) {
|
|
|
329
322
|
};
|
|
330
323
|
}
|
|
331
324
|
function applyPosition(root, positionedElement, options) {
|
|
332
|
-
if (options.position === "inline")
|
|
333
|
-
|
|
334
|
-
if (options.zIndex != null)
|
|
335
|
-
root.style.zIndex = String(options.zIndex);
|
|
325
|
+
if (options.position === "inline") return;
|
|
326
|
+
if (options.zIndex != null) root.style.zIndex = String(options.zIndex);
|
|
336
327
|
root.style.overflow = "visible";
|
|
337
328
|
root.style.position = "relative";
|
|
338
329
|
root.style.width = "0";
|
|
@@ -343,12 +334,10 @@ function applyPosition(root, positionedElement, options) {
|
|
|
343
334
|
positionedElement.style.position = "absolute";
|
|
344
335
|
if (options.alignment?.startsWith("bottom-"))
|
|
345
336
|
positionedElement.style.bottom = "0";
|
|
346
|
-
else
|
|
347
|
-
positionedElement.style.top = "0";
|
|
337
|
+
else positionedElement.style.top = "0";
|
|
348
338
|
if (options.alignment?.endsWith("-right"))
|
|
349
339
|
positionedElement.style.right = "0";
|
|
350
|
-
else
|
|
351
|
-
positionedElement.style.left = "0";
|
|
340
|
+
else positionedElement.style.left = "0";
|
|
352
341
|
} else {
|
|
353
342
|
positionedElement.style.position = "fixed";
|
|
354
343
|
positionedElement.style.top = "0";
|
|
@@ -359,8 +348,7 @@ function applyPosition(root, positionedElement, options) {
|
|
|
359
348
|
}
|
|
360
349
|
}
|
|
361
350
|
function getAnchor(options) {
|
|
362
|
-
if (options.anchor == null)
|
|
363
|
-
return document.body;
|
|
351
|
+
if (options.anchor == null) return document.body;
|
|
364
352
|
let resolved = typeof options.anchor === "function" ? options.anchor() : options.anchor;
|
|
365
353
|
if (typeof resolved === "string")
|
|
366
354
|
return document.querySelector(resolved) ?? void 0;
|