@multiplatform.one/vite-plugin-vscode 6.6.0 → 6.7.0
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 +7 -4
- package/lib/index.mjs +7 -5
- package/package.json +7 -3
- package/src/index.ts +8 -4
- package/types/index.d.ts +2 -2
- package/types/index.d.ts.map +1 -1
package/lib/index.cjs
CHANGED
|
@@ -31,6 +31,8 @@ node_fs = __toESM(node_fs, 1);
|
|
|
31
31
|
let node_path = require("node:path");
|
|
32
32
|
node_path = __toESM(node_path, 1);
|
|
33
33
|
let _multiplatform_one_utils_dev = require("@multiplatform.one/utils/dev");
|
|
34
|
+
let _rolldown_plugin_babel = require("@rolldown/plugin-babel");
|
|
35
|
+
_rolldown_plugin_babel = __toESM(_rolldown_plugin_babel, 1);
|
|
34
36
|
let _tomjs_vite_plugin_vscode = require("@tomjs/vite-plugin-vscode");
|
|
35
37
|
_tomjs_vite_plugin_vscode = __toESM(_tomjs_vite_plugin_vscode, 1);
|
|
36
38
|
let _vitejs_plugin_react = require("@vitejs/plugin-react");
|
|
@@ -88,6 +90,7 @@ async function createVscodeConfig(options) {
|
|
|
88
90
|
(0, _multiplatform_one_utils_dev.stubExpoTypeDeclarations)(),
|
|
89
91
|
(0, _multiplatform_one_utils_dev.oneServerOnlyBrowserStub)(workspaceRoot),
|
|
90
92
|
(0, _vitejs_plugin_react.default)({ jsxRuntime: "automatic" }),
|
|
93
|
+
(0, _rolldown_plugin_babel.default)({ presets: [(0, _vitejs_plugin_react.reactCompilerPreset)()] }),
|
|
91
94
|
tamaguiPlugin({
|
|
92
95
|
components: (0, _multiplatform_one_utils_dev.lookupTamaguiModules)([options.targetDir]),
|
|
93
96
|
config: options.tamaguiConfig,
|
|
@@ -194,7 +197,7 @@ async function createVscodeConfig(options) {
|
|
|
194
197
|
* `"webview"` (the assets dir next to the generated package.json), so the
|
|
195
198
|
* staging step rewrites the joinPath call site — anchored on the
|
|
196
199
|
* `.extensionUri` property read, which survives minification. */
|
|
197
|
-
async function
|
|
200
|
+
async function fixStagedWebviewAssetUris(stagingDir) {
|
|
198
201
|
const bundles = ["extension/index.js", "extension/index.cjs"].map((file) => node_path.default.join(stagingDir, file));
|
|
199
202
|
let fixed = false;
|
|
200
203
|
for (const bundle of bundles) {
|
|
@@ -212,7 +215,7 @@ async function fixWebviewDistPath(stagingDir) {
|
|
|
212
215
|
* Code extension's package.json IS its manifest — the product app's own
|
|
213
216
|
* package.json (an Expo/One app manifest) can't double as it, so `vsce
|
|
214
217
|
* package` runs against the staging dir instead. Also applies
|
|
215
|
-
* `
|
|
218
|
+
* `fixStagedWebviewAssetUris` — staging is the earliest race-free point after
|
|
216
219
|
* the plugin's detached extension-host build has finished. */
|
|
217
220
|
async function writeVsceManifest(stagingDir, manifest) {
|
|
218
221
|
const { engines, main, ...rest } = manifest;
|
|
@@ -226,12 +229,12 @@ async function writeVsceManifest(stagingDir, manifest) {
|
|
|
226
229
|
};
|
|
227
230
|
await node_fs.default.promises.mkdir(stagingDir, { recursive: true });
|
|
228
231
|
await node_fs.default.promises.writeFile(node_path.default.join(stagingDir, "package.json"), `${JSON.stringify(packageJson, null, 2)}\n`, "utf-8");
|
|
229
|
-
await
|
|
232
|
+
await fixStagedWebviewAssetUris(stagingDir);
|
|
230
233
|
}
|
|
231
234
|
|
|
232
235
|
//#endregion
|
|
233
236
|
exports.DEFAULT_WEBVIEW_CSP = DEFAULT_WEBVIEW_CSP;
|
|
234
237
|
exports.createVscodeConfig = createVscodeConfig;
|
|
235
|
-
exports.
|
|
238
|
+
exports.fixStagedWebviewAssetUris = fixStagedWebviewAssetUris;
|
|
236
239
|
exports.resolveSeamOneAdapter = resolveSeamOneAdapter;
|
|
237
240
|
exports.writeVsceManifest = writeVsceManifest;
|
package/lib/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { lookupProjectRoot, lookupTamaguiModules, oneServerOnlyBrowserStub, stubExpoTypeDeclarations, workspaceSourceAliases } from "@multiplatform.one/utils/dev";
|
|
4
|
+
import babel from "@rolldown/plugin-babel";
|
|
4
5
|
import vscode from "@tomjs/vite-plugin-vscode";
|
|
5
|
-
import react from "@vitejs/plugin-react";
|
|
6
|
+
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
|
|
6
7
|
|
|
7
8
|
//#region src/index.ts
|
|
8
9
|
/** Default CSP: the plugin's default lacks font-src/img-src and blocks
|
|
@@ -56,6 +57,7 @@ async function createVscodeConfig(options) {
|
|
|
56
57
|
stubExpoTypeDeclarations(),
|
|
57
58
|
oneServerOnlyBrowserStub(workspaceRoot),
|
|
58
59
|
react({ jsxRuntime: "automatic" }),
|
|
60
|
+
babel({ presets: [reactCompilerPreset()] }),
|
|
59
61
|
tamaguiPlugin({
|
|
60
62
|
components: lookupTamaguiModules([options.targetDir]),
|
|
61
63
|
config: options.tamaguiConfig,
|
|
@@ -162,7 +164,7 @@ async function createVscodeConfig(options) {
|
|
|
162
164
|
* `"webview"` (the assets dir next to the generated package.json), so the
|
|
163
165
|
* staging step rewrites the joinPath call site — anchored on the
|
|
164
166
|
* `.extensionUri` property read, which survives minification. */
|
|
165
|
-
async function
|
|
167
|
+
async function fixStagedWebviewAssetUris(stagingDir) {
|
|
166
168
|
const bundles = ["extension/index.js", "extension/index.cjs"].map((file) => path.join(stagingDir, file));
|
|
167
169
|
let fixed = false;
|
|
168
170
|
for (const bundle of bundles) {
|
|
@@ -180,7 +182,7 @@ async function fixWebviewDistPath(stagingDir) {
|
|
|
180
182
|
* Code extension's package.json IS its manifest — the product app's own
|
|
181
183
|
* package.json (an Expo/One app manifest) can't double as it, so `vsce
|
|
182
184
|
* package` runs against the staging dir instead. Also applies
|
|
183
|
-
* `
|
|
185
|
+
* `fixStagedWebviewAssetUris` — staging is the earliest race-free point after
|
|
184
186
|
* the plugin's detached extension-host build has finished. */
|
|
185
187
|
async function writeVsceManifest(stagingDir, manifest) {
|
|
186
188
|
const { engines, main, ...rest } = manifest;
|
|
@@ -194,8 +196,8 @@ async function writeVsceManifest(stagingDir, manifest) {
|
|
|
194
196
|
};
|
|
195
197
|
await fs.promises.mkdir(stagingDir, { recursive: true });
|
|
196
198
|
await fs.promises.writeFile(path.join(stagingDir, "package.json"), `${JSON.stringify(packageJson, null, 2)}\n`, "utf-8");
|
|
197
|
-
await
|
|
199
|
+
await fixStagedWebviewAssetUris(stagingDir);
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
//#endregion
|
|
201
|
-
export { DEFAULT_WEBVIEW_CSP, createVscodeConfig,
|
|
203
|
+
export { DEFAULT_WEBVIEW_CSP, createVscodeConfig, fixStagedWebviewAssetUris, resolveSeamOneAdapter, writeVsceManifest };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/vite-plugin-vscode",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.7.0",
|
|
4
4
|
"description": "Vite config factory for building a VS Code extension (extension host + Tamagui webview) as a target of a multiplatform.one One app — wraps @tomjs/vite-plugin-vscode with the workspace source aliases, the one-router seam alias, React dedupe against one's vendored copy, and a vsce staging-manifest writer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"multiplatform.one",
|
|
@@ -46,11 +46,15 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@
|
|
49
|
+
"@babel/core": "^7.26.0",
|
|
50
|
+
"@rolldown/plugin-babel": "^0.2.3",
|
|
51
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
52
|
+
"@multiplatform.one/utils": "6.7.0"
|
|
50
53
|
},
|
|
51
54
|
"devDependencies": {
|
|
52
55
|
"@tamagui/vite-plugin": "2.0.0-rc.41",
|
|
53
56
|
"@tomjs/vite-plugin-vscode": "^7.1.1",
|
|
57
|
+
"@types/babel__core": "^7.20.5",
|
|
54
58
|
"@types/node": "^25.6.0",
|
|
55
59
|
"@vitejs/plugin-react": "^6.0.1",
|
|
56
60
|
"typescript": "~5.9.3",
|
|
@@ -63,7 +67,7 @@
|
|
|
63
67
|
"vite": ">=5"
|
|
64
68
|
},
|
|
65
69
|
"scripts": {
|
|
66
|
-
"typecheck": "
|
|
70
|
+
"typecheck": "tsgo --noEmit",
|
|
67
71
|
"build": "rm -rf lib types 2>/dev/null && tsc -b --emitDeclarationOnly && tsdown"
|
|
68
72
|
}
|
|
69
73
|
}
|
package/src/index.ts
CHANGED
|
@@ -29,8 +29,9 @@ import {
|
|
|
29
29
|
stubExpoTypeDeclarations,
|
|
30
30
|
workspaceSourceAliases,
|
|
31
31
|
} from "@multiplatform.one/utils/dev";
|
|
32
|
+
import babel from "@rolldown/plugin-babel";
|
|
32
33
|
import vscode from "@tomjs/vite-plugin-vscode";
|
|
33
|
-
import react from "@vitejs/plugin-react";
|
|
34
|
+
import react, { reactCompilerPreset } from "@vitejs/plugin-react";
|
|
34
35
|
import type { Alias, Plugin, UserConfig } from "vite";
|
|
35
36
|
|
|
36
37
|
/** Default CSP: the plugin's default lacks font-src/img-src and blocks
|
|
@@ -117,6 +118,9 @@ export async function createVscodeConfig(options: VscodeTargetOptions): Promise<
|
|
|
117
118
|
stubExpoTypeDeclarations(),
|
|
118
119
|
oneServerOnlyBrowserStub(workspaceRoot),
|
|
119
120
|
react({ jsxRuntime: "automatic" }),
|
|
121
|
+
// Same React Compiler pass the One app runs — the webview gets the
|
|
122
|
+
// memoization for free (react 19 built-in runtime).
|
|
123
|
+
babel({ presets: [reactCompilerPreset()] }),
|
|
120
124
|
tamaguiPlugin({
|
|
121
125
|
components: lookupTamaguiModules([options.targetDir]),
|
|
122
126
|
config: options.tamaguiConfig,
|
|
@@ -239,7 +243,7 @@ export interface VsceManifest {
|
|
|
239
243
|
* `"webview"` (the assets dir next to the generated package.json), so the
|
|
240
244
|
* staging step rewrites the joinPath call site — anchored on the
|
|
241
245
|
* `.extensionUri` property read, which survives minification. */
|
|
242
|
-
export async function
|
|
246
|
+
export async function fixStagedWebviewAssetUris(stagingDir: string): Promise<boolean> {
|
|
243
247
|
const bundles = ["extension/index.js", "extension/index.cjs"].map((file) =>
|
|
244
248
|
path.join(stagingDir, file),
|
|
245
249
|
);
|
|
@@ -265,7 +269,7 @@ export async function fixWebviewDistPath(stagingDir: string): Promise<boolean> {
|
|
|
265
269
|
* Code extension's package.json IS its manifest — the product app's own
|
|
266
270
|
* package.json (an Expo/One app manifest) can't double as it, so `vsce
|
|
267
271
|
* package` runs against the staging dir instead. Also applies
|
|
268
|
-
* `
|
|
272
|
+
* `fixStagedWebviewAssetUris` — staging is the earliest race-free point after
|
|
269
273
|
* the plugin's detached extension-host build has finished. */
|
|
270
274
|
export async function writeVsceManifest(stagingDir: string, manifest: VsceManifest): Promise<void> {
|
|
271
275
|
const { engines, main, ...rest } = manifest;
|
|
@@ -280,5 +284,5 @@ export async function writeVsceManifest(stagingDir: string, manifest: VsceManife
|
|
|
280
284
|
`${JSON.stringify(packageJson, null, 2)}\n`,
|
|
281
285
|
"utf-8",
|
|
282
286
|
);
|
|
283
|
-
await
|
|
287
|
+
await fixStagedWebviewAssetUris(stagingDir);
|
|
284
288
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -64,12 +64,12 @@ export interface VsceManifest {
|
|
|
64
64
|
* `"webview"` (the assets dir next to the generated package.json), so the
|
|
65
65
|
* staging step rewrites the joinPath call site — anchored on the
|
|
66
66
|
* `.extensionUri` property read, which survives minification. */
|
|
67
|
-
export declare function
|
|
67
|
+
export declare function fixStagedWebviewAssetUris(stagingDir: string): Promise<boolean>;
|
|
68
68
|
/** Write the extension-manifest package.json into the staging dir. A VS
|
|
69
69
|
* Code extension's package.json IS its manifest — the product app's own
|
|
70
70
|
* package.json (an Expo/One app manifest) can't double as it, so `vsce
|
|
71
71
|
* package` runs against the staging dir instead. Also applies
|
|
72
|
-
* `
|
|
72
|
+
* `fixStagedWebviewAssetUris` — staging is the earliest race-free point after
|
|
73
73
|
* the plugin's detached extension-host build has finished. */
|
|
74
74
|
export declare function writeVsceManifest(stagingDir: string, manifest: VsceManifest): Promise<void>;
|
|
75
75
|
//# sourceMappingURL=index.d.ts.map
|
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":"AAkCA,OAAO,KAAK,EAAE,KAAK,EAAU,UAAU,EAAE,MAAM,MAAM,CAAC;AAEtD;;;0CAG0C;AAC1C,eAAO,MAAM,mBAAmB,yRAAqR,CAAC;AAEtT,MAAM,WAAW,mBAAmB;IAClC;kCAC8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB;kEAC8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,aAAa,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,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;AAgBD;kEACkE;AAClE,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAInE;AAED,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CA0H1F;AAID,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC7B,2CAA2C;IAC3C,OAAO,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACpD,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;kEAckE;AAClE,wBAAsB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoBpF;AAED;;;;;+DAK+D;AAC/D,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAcjG"}
|