@multiplatform.one/vite-plugin-webext 10.0.0 → 10.1.1
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/lib/index.cjs +9 -4
- package/lib/index.mjs +10 -5
- package/package.json +2 -2
- package/src/index.ts +10 -3
- package/types/index.d.ts +1 -1
- package/types/index.d.ts.map +1 -1
package/lib/index.cjs
CHANGED
|
@@ -140,6 +140,10 @@ function baseResolve(options, workspaceRoot, workspaceRootInferred) {
|
|
|
140
140
|
find,
|
|
141
141
|
replacement
|
|
142
142
|
})),
|
|
143
|
+
...Object.entries((0, _multiplatform_one_utils_dev.movedDepAliases)(workspaceRoot)).map(([find, replacement]) => ({
|
|
144
|
+
find,
|
|
145
|
+
replacement
|
|
146
|
+
})),
|
|
143
147
|
{
|
|
144
148
|
find: "react-native",
|
|
145
149
|
replacement: "react-native-web"
|
|
@@ -185,6 +189,7 @@ async function createWebextViewsConfig(options) {
|
|
|
185
189
|
base: isDev ? `http://localhost:${port}/` : "/dist/",
|
|
186
190
|
plugins: [
|
|
187
191
|
(0, _multiplatform_one_utils_dev.stubExpoTypeDeclarations)(),
|
|
192
|
+
(0, _multiplatform_one_utils_dev.nativeOnlyDepStubPlugin)(workspaceRoot),
|
|
188
193
|
(0, _multiplatform_one_utils_dev.oneServerOnlyBrowserStub)(workspaceRoot),
|
|
189
194
|
react({ jsxRuntime: "automatic" }),
|
|
190
195
|
(0, _rolldown_plugin_babel.default)({ presets: [reactCompilerPreset()] }),
|
|
@@ -229,7 +234,7 @@ function createWebextBackgroundConfig(options) {
|
|
|
229
234
|
const { workspaceRoot, workspaceRootInferred, isDev } = resolveDefaults(options);
|
|
230
235
|
return {
|
|
231
236
|
root: options.targetDir,
|
|
232
|
-
plugins: [(0, _multiplatform_one_utils_dev.oneServerOnlyBrowserStub)(workspaceRoot)],
|
|
237
|
+
plugins: [(0, _multiplatform_one_utils_dev.nativeOnlyDepStubPlugin)(workspaceRoot), (0, _multiplatform_one_utils_dev.oneServerOnlyBrowserStub)(workspaceRoot)],
|
|
233
238
|
define: baseDefine(options, isDev),
|
|
234
239
|
optimizeDeps: baseOptimizeDeps(),
|
|
235
240
|
esbuild: {
|
|
@@ -256,7 +261,7 @@ function createWebextBackgroundConfig(options) {
|
|
|
256
261
|
};
|
|
257
262
|
}
|
|
258
263
|
/** The content-script build — a single-file iife injected into pages, with
|
|
259
|
-
*
|
|
264
|
+
* the CSS it imports extracted separately (webext.css web-accessible resource). */
|
|
260
265
|
async function createWebextContentConfig(options) {
|
|
261
266
|
const { workspaceRoot, workspaceRootInferred, isDev } = resolveDefaults(options);
|
|
262
267
|
const { default: react, reactCompilerPreset } = await importPeer(() => import("@vitejs/plugin-react"), "@vitejs/plugin-react");
|
|
@@ -265,14 +270,14 @@ async function createWebextContentConfig(options) {
|
|
|
265
270
|
root: options.targetDir,
|
|
266
271
|
plugins: [
|
|
267
272
|
(0, _multiplatform_one_utils_dev.stubExpoTypeDeclarations)(),
|
|
273
|
+
(0, _multiplatform_one_utils_dev.nativeOnlyDepStubPlugin)(workspaceRoot),
|
|
268
274
|
(0, _multiplatform_one_utils_dev.oneServerOnlyBrowserStub)(workspaceRoot),
|
|
269
275
|
shikiStubPlugin(),
|
|
270
276
|
react({ jsxRuntime: "automatic" }),
|
|
271
277
|
(0, _rolldown_plugin_babel.default)({ presets: [reactCompilerPreset()] }),
|
|
272
278
|
tamaguiPlugin({
|
|
273
279
|
components: (0, _multiplatform_one_utils_dev.lookupTamaguiModules)([options.targetDir]),
|
|
274
|
-
config: options.tamaguiConfig
|
|
275
|
-
outputCSS: node_path.default.join(options.targetDir, "tamagui.content.css")
|
|
280
|
+
config: options.tamaguiConfig
|
|
276
281
|
}),
|
|
277
282
|
tamaguiConfigBundleGuard(isDev)
|
|
278
283
|
],
|
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { lookupProjectRoot, lookupTamaguiModules, oneServerOnlyBrowserStub, stubExpoTypeDeclarations, workspaceSourceAliases } from "@multiplatform.one/utils/dev";
|
|
3
|
+
import { lookupProjectRoot, lookupTamaguiModules, movedDepAliases, nativeOnlyDepStubPlugin, oneServerOnlyBrowserStub, stubExpoTypeDeclarations, workspaceSourceAliases } from "@multiplatform.one/utils/dev";
|
|
4
4
|
import babel from "@rolldown/plugin-babel";
|
|
5
5
|
|
|
6
6
|
//#region src/index.ts
|
|
@@ -109,6 +109,10 @@ function baseResolve(options, workspaceRoot, workspaceRootInferred) {
|
|
|
109
109
|
find,
|
|
110
110
|
replacement
|
|
111
111
|
})),
|
|
112
|
+
...Object.entries(movedDepAliases(workspaceRoot)).map(([find, replacement]) => ({
|
|
113
|
+
find,
|
|
114
|
+
replacement
|
|
115
|
+
})),
|
|
112
116
|
{
|
|
113
117
|
find: "react-native",
|
|
114
118
|
replacement: "react-native-web"
|
|
@@ -154,6 +158,7 @@ async function createWebextViewsConfig(options) {
|
|
|
154
158
|
base: isDev ? `http://localhost:${port}/` : "/dist/",
|
|
155
159
|
plugins: [
|
|
156
160
|
stubExpoTypeDeclarations(),
|
|
161
|
+
nativeOnlyDepStubPlugin(workspaceRoot),
|
|
157
162
|
oneServerOnlyBrowserStub(workspaceRoot),
|
|
158
163
|
react({ jsxRuntime: "automatic" }),
|
|
159
164
|
babel({ presets: [reactCompilerPreset()] }),
|
|
@@ -198,7 +203,7 @@ function createWebextBackgroundConfig(options) {
|
|
|
198
203
|
const { workspaceRoot, workspaceRootInferred, isDev } = resolveDefaults(options);
|
|
199
204
|
return {
|
|
200
205
|
root: options.targetDir,
|
|
201
|
-
plugins: [oneServerOnlyBrowserStub(workspaceRoot)],
|
|
206
|
+
plugins: [nativeOnlyDepStubPlugin(workspaceRoot), oneServerOnlyBrowserStub(workspaceRoot)],
|
|
202
207
|
define: baseDefine(options, isDev),
|
|
203
208
|
optimizeDeps: baseOptimizeDeps(),
|
|
204
209
|
esbuild: {
|
|
@@ -225,7 +230,7 @@ function createWebextBackgroundConfig(options) {
|
|
|
225
230
|
};
|
|
226
231
|
}
|
|
227
232
|
/** The content-script build — a single-file iife injected into pages, with
|
|
228
|
-
*
|
|
233
|
+
* the CSS it imports extracted separately (webext.css web-accessible resource). */
|
|
229
234
|
async function createWebextContentConfig(options) {
|
|
230
235
|
const { workspaceRoot, workspaceRootInferred, isDev } = resolveDefaults(options);
|
|
231
236
|
const { default: react, reactCompilerPreset } = await importPeer(() => import("@vitejs/plugin-react"), "@vitejs/plugin-react");
|
|
@@ -234,14 +239,14 @@ async function createWebextContentConfig(options) {
|
|
|
234
239
|
root: options.targetDir,
|
|
235
240
|
plugins: [
|
|
236
241
|
stubExpoTypeDeclarations(),
|
|
242
|
+
nativeOnlyDepStubPlugin(workspaceRoot),
|
|
237
243
|
oneServerOnlyBrowserStub(workspaceRoot),
|
|
238
244
|
shikiStubPlugin(),
|
|
239
245
|
react({ jsxRuntime: "automatic" }),
|
|
240
246
|
babel({ presets: [reactCompilerPreset()] }),
|
|
241
247
|
tamaguiPlugin({
|
|
242
248
|
components: lookupTamaguiModules([options.targetDir]),
|
|
243
|
-
config: options.tamaguiConfig
|
|
244
|
-
outputCSS: path.join(options.targetDir, "tamagui.content.css")
|
|
249
|
+
config: options.tamaguiConfig
|
|
245
250
|
}),
|
|
246
251
|
tamaguiConfigBundleGuard(isDev)
|
|
247
252
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/vite-plugin-webext",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.1",
|
|
4
4
|
"description": "Vite config factories for building a browser web extension (MV3 views, background service worker, content scripts) as a target of a multiplatform.one One app — workspace source aliases, the one-server-only browser stub, Tamagui wiring, and the manifest/dev-reload prepare pipeline.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"browser-extension",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/core": "^7.26.0",
|
|
50
|
-
"@multiplatform.one/utils": "^10.
|
|
50
|
+
"@multiplatform.one/utils": "^10.1.1",
|
|
51
51
|
"@rolldown/plugin-babel": "^0.2.4",
|
|
52
52
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
53
53
|
"chokidar": "^5.0.0"
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,8 @@ import fs from "node:fs";
|
|
|
20
20
|
import path from "node:path";
|
|
21
21
|
import {
|
|
22
22
|
lookupTamaguiModules,
|
|
23
|
+
movedDepAliases,
|
|
24
|
+
nativeOnlyDepStubPlugin,
|
|
23
25
|
oneServerOnlyBrowserStub,
|
|
24
26
|
stubExpoTypeDeclarations,
|
|
25
27
|
workspaceSourceAliases,
|
|
@@ -195,6 +197,10 @@ function baseResolve(
|
|
|
195
197
|
find,
|
|
196
198
|
replacement,
|
|
197
199
|
})),
|
|
200
|
+
...Object.entries(movedDepAliases(workspaceRoot)).map(([find, replacement]) => ({
|
|
201
|
+
find,
|
|
202
|
+
replacement,
|
|
203
|
+
})),
|
|
198
204
|
{ find: "react-native", replacement: "react-native-web" },
|
|
199
205
|
{ find: "@", replacement: options.targetDir },
|
|
200
206
|
...(options.aliases ?? []),
|
|
@@ -244,6 +250,7 @@ export async function createWebextViewsConfig(options: WebextTargetOptions): Pro
|
|
|
244
250
|
base: isDev ? `http://localhost:${port}/` : "/dist/",
|
|
245
251
|
plugins: [
|
|
246
252
|
stubExpoTypeDeclarations(),
|
|
253
|
+
nativeOnlyDepStubPlugin(workspaceRoot),
|
|
247
254
|
oneServerOnlyBrowserStub(workspaceRoot),
|
|
248
255
|
react({ jsxRuntime: "automatic" }),
|
|
249
256
|
// Same React Compiler pass the One app runs (react 19 built-in
|
|
@@ -299,7 +306,7 @@ export function createWebextBackgroundConfig(options: WebextTargetOptions): User
|
|
|
299
306
|
const { workspaceRoot, workspaceRootInferred, isDev } = resolveDefaults(options);
|
|
300
307
|
return {
|
|
301
308
|
root: options.targetDir,
|
|
302
|
-
plugins: [oneServerOnlyBrowserStub(workspaceRoot)],
|
|
309
|
+
plugins: [nativeOnlyDepStubPlugin(workspaceRoot), oneServerOnlyBrowserStub(workspaceRoot)],
|
|
303
310
|
define: baseDefine(options, isDev),
|
|
304
311
|
optimizeDeps: baseOptimizeDeps(),
|
|
305
312
|
esbuild: {
|
|
@@ -329,7 +336,7 @@ export function createWebextBackgroundConfig(options: WebextTargetOptions): User
|
|
|
329
336
|
}
|
|
330
337
|
|
|
331
338
|
/** The content-script build — a single-file iife injected into pages, with
|
|
332
|
-
*
|
|
339
|
+
* the CSS it imports extracted separately (webext.css web-accessible resource). */
|
|
333
340
|
export async function createWebextContentConfig(options: WebextTargetOptions): Promise<UserConfig> {
|
|
334
341
|
const { workspaceRoot, workspaceRootInferred, isDev } = resolveDefaults(options);
|
|
335
342
|
const { default: react, reactCompilerPreset } = await importPeer(
|
|
@@ -344,6 +351,7 @@ export async function createWebextContentConfig(options: WebextTargetOptions): P
|
|
|
344
351
|
root: options.targetDir,
|
|
345
352
|
plugins: [
|
|
346
353
|
stubExpoTypeDeclarations(),
|
|
354
|
+
nativeOnlyDepStubPlugin(workspaceRoot),
|
|
347
355
|
oneServerOnlyBrowserStub(workspaceRoot),
|
|
348
356
|
shikiStubPlugin(),
|
|
349
357
|
// The react plugin transforms JSX (the esbuild jsx setting below
|
|
@@ -353,7 +361,6 @@ export async function createWebextContentConfig(options: WebextTargetOptions): P
|
|
|
353
361
|
tamaguiPlugin({
|
|
354
362
|
components: lookupTamaguiModules([options.targetDir]),
|
|
355
363
|
config: options.tamaguiConfig,
|
|
356
|
-
outputCSS: path.join(options.targetDir, "tamagui.content.css"),
|
|
357
364
|
}) as Plugin,
|
|
358
365
|
tamaguiConfigBundleGuard(isDev),
|
|
359
366
|
],
|
package/types/index.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export declare function createWebextViewsConfig(options: WebextTargetOptions): P
|
|
|
42
42
|
* build — a single-file iife, no DOM. */
|
|
43
43
|
export declare function createWebextBackgroundConfig(options: WebextTargetOptions): UserConfig;
|
|
44
44
|
/** The content-script build — a single-file iife injected into pages, with
|
|
45
|
-
*
|
|
45
|
+
* the CSS it imports extracted separately (webext.css web-accessible resource). */
|
|
46
46
|
export declare function createWebextContentConfig(options: WebextTargetOptions): Promise<UserConfig>;
|
|
47
47
|
export interface WebextPrepareOptions {
|
|
48
48
|
targetDir: string;
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAMtD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC;0CACsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB;2EACuE;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;qCACiC;IACjC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC;CACnB;AA4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