@multiplatform.one/vite-plugin-vscode 7.90.3 → 7.90.5
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/README.md +67 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @multiplatform.one/vite-plugin-vscode
|
|
2
|
+
|
|
3
|
+
Vite config factory for building a VS Code extension (extension host +
|
|
4
|
+
Tamagui webview) as a target of a multiplatform.one One app. It wraps
|
|
5
|
+
`@tomjs/vite-plugin-vscode` in its `recommended` mode: tsdown builds the
|
|
6
|
+
extension host, vite builds the webview. The target lives inside the
|
|
7
|
+
product app, with the layout that mode expects:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
<targetDir>/index.html (webview entry, vite root)
|
|
11
|
+
<targetDir>/extension/index.ts (extension host)
|
|
12
|
+
<targetDir>/webview/… (webview React sources, aliased as @)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
The build lands under `outDir` as `extension/` + `webview/`.
|
|
16
|
+
`writeVsceManifest` then writes the extension-manifest `package.json`
|
|
17
|
+
next to them, so `vsce package` runs against that staging dir: the
|
|
18
|
+
product app's own `package.json` is an Expo/One manifest and can't
|
|
19
|
+
double as the extension's.
|
|
20
|
+
|
|
21
|
+
## Exports
|
|
22
|
+
|
|
23
|
+
| export | what it is |
|
|
24
|
+
| ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| `createVscodeConfig(options)` | async; the vite `UserConfig`: React + the React Compiler preset, Tamagui extraction, `@tomjs/vite-plugin-vscode`, workspace source aliases, `one` → router seam |
|
|
26
|
+
| `writeVsceManifest(stagingDir, manifest)` | writes `<stagingDir>/package.json` (`main` defaults to `extension/index.js`, `engines.vscode` to `^1.75.0`), then runs `fixStagedWebviewAssetUris` |
|
|
27
|
+
| `fixStagedWebviewAssetUris(stagingDir)` | rewrites the webview dist path baked into the extension-host bundle to `"webview"`, so webview assets resolve from the staging dir |
|
|
28
|
+
| `resolveSeamOneAdapter(workspaceRoot)` | the seam's one-adapter: workspace source inside the monorepo, `@multiplatform.one/router/seam` otherwise |
|
|
29
|
+
| `DEFAULT_WEBVIEW_CSP` | the webview CSP meta used when `csp` is not passed; unlike the plugin's default it allows `img-src` and `font-src` |
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// vite.config.vscode.ts
|
|
35
|
+
import { resolve } from "node:path";
|
|
36
|
+
import { createVscodeConfig } from "@multiplatform.one/vite-plugin-vscode";
|
|
37
|
+
import { defineConfig } from "vite";
|
|
38
|
+
|
|
39
|
+
export default defineConfig(async () =>
|
|
40
|
+
createVscodeConfig({
|
|
41
|
+
targetDir: resolve(import.meta.dirname, "vscode"),
|
|
42
|
+
outDir: resolve(import.meta.dirname, "dist-vscode"),
|
|
43
|
+
tamaguiConfig: resolve(import.meta.dirname, "config/tamagui.config.ts"),
|
|
44
|
+
}),
|
|
45
|
+
);
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Optional: `workspaceRoot` (defaults to the git toplevel), `csp`, `isDev`
|
|
49
|
+
(defaults to `NODE_ENV !== "production"`), `define` (merged over the
|
|
50
|
+
factory's defines) and `aliases` (appended after the factory's). After
|
|
51
|
+
`vite build`, a staging script calls
|
|
52
|
+
`writeVsceManifest(outDir, { name, publisher, version, contributes, … })`.
|
|
53
|
+
|
|
54
|
+
## Required dependencies
|
|
55
|
+
|
|
56
|
+
Declared peers, install them next to this plugin:
|
|
57
|
+
|
|
58
|
+
| package | why |
|
|
59
|
+
| ------------------------------- | -------------------------------------------------------- |
|
|
60
|
+
| `vite` >=5 | the build tool itself |
|
|
61
|
+
| `@tomjs/vite-plugin-vscode` >=7 | extension-host and webview builds |
|
|
62
|
+
| `@vitejs/plugin-react` >=4 | webview build (React + the React Compiler preset) |
|
|
63
|
+
| `@tamagui/vite-plugin` | webview static extraction. Lazy-imported at factory call |
|
|
64
|
+
|
|
65
|
+
The factory aliases `react`, `react-dom` and the jsx runtimes to
|
|
66
|
+
`<workspaceRoot>/node_modules/react*`, so `one`'s vendored React 18
|
|
67
|
+
never reaches the webview. Install both at the workspace root.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/vite-plugin-vscode",
|
|
3
|
-
"version": "7.90.
|
|
3
|
+
"version": "7.90.5",
|
|
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",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@babel/core": "^7.26.0",
|
|
50
|
-
"@multiplatform.one/utils": "^7.90.
|
|
50
|
+
"@multiplatform.one/utils": "^7.90.5",
|
|
51
51
|
"@rolldown/plugin-babel": "^0.2.4",
|
|
52
52
|
"babel-plugin-react-compiler": "^1.0.0"
|
|
53
53
|
},
|